-
perlgolf_history_070109.pdf下载
资源介绍
Perlgolf History
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 2 of 520
Contents
1.
Intro..............................................................................................................................................11
2.
On The Game...............................................................................................................................13
2.1.
History.....................................................................................................................................13
2.2.
For Newbies............................................................................................................................13
2.3.
Notation...................................................................................................................................13
2.4.
Generic Rules..........................................................................................................................14
2.4.1.
Perl Versions..............................................................................................................................................................................................16
2.4.2.
Some Assumptions.....................................................................................................................................................................................16
2.5.
Open Source Tournament Engines..........................................................................................17
2.5.1.
PGAS..........................................................................................................................................................................................................17
2.5.2.
JAGGS.......................................................................................................................................................................................................17
3.
Games – Pretournaments...........................................................................................................18
3.1.
Andrew’s Santa Claus Golf Apocalypse.................................................................................18
3.1.1.
Rules...........................................................................................................................................................................................................18
3.1.2.
Solutions Hole 1 (head)..............................................................................................................................................................................19
3.1.3.
Solutions Hole 2 (tail).................................................................................................................................................................................20
3.1.4.
Solutions Hole 3 (rev).................................................................................................................................................................................21
3.1.5.
Solutions Hole 4 (mid)................................................................................................................................................................................22
3.1.6.
Solutions Hole 5 (wc).................................................................................................................................................................................24
3.2.
Ton’s Open Ircnet Perl Golf Challenge...................................................................................26
3.2.1.
Rules...........................................................................................................................................................................................................26
3.2.2.
Solutions with explanation..........................................................................................................................................................................27
3.3.
Andrew’s “Get Even”..............................................................................................................34
3.3.1.
Rules...........................................................................................................................................................................................................34
3.3.2.
Solutions Hole 1 (Get Even).......................................................................................................................................................................36
3.3.3.
Solutions Hole 2 (Golf Scorer)...................................................................................................................................................................40
3.4.
LAPM#1 "Factorial"...............................................................................................................43
3.4.1.
Rules...........................................................................................................................................................................................................43
3.4.2.
Solutions.....................................................................................................................................................................................................43
3.5.
LAPM#2 "Hamming Code"....................................................................................................44
3.5.1.
Rules...........................................................................................................................................................................................................44
3.5.2.
Solutions.....................................................................................................................................................................................................45
3.6.
TopMach’s "Arabic to Roman number translator".................................................................45
3.6.1.
Rules...........................................................................................................................................................................................................46
3.6.2.
Solutions.....................................................................................................................................................................................................47
3.7.
TopMach’s "Odd Number Math Magic Square"....................................................................47
3.7.1.
Rules...........................................................................................................................................................................................................47
3.7.2.
Solutions.....................................................................................................................................................................................................48
3.7.3.
Explanation.................................................................................................................................................................................................48
3.8.
Ton’s Minigolf 2 "Closest Number".......................................................................................48
3.8.1.
Rules...........................................................................................................................................................................................................48
3.8.2.
Solutions.....................................................................................................................................................................................................49
3.9.
Ton’s Midigolf 1 "Labyrinth".................................................................................................49
3.9.1.
Rules...........................................................................................................................................................................................................49
3.9.2.
Solutions.....................................................................................................................................................................................................49
3.10. Ton’s Irongolf 1......................................................................................................................49
3.10.1. Rules...........................................................................................................................................................................................................49
3.10.2. Solutions.....................................................................................................................................................................................................51
3.11. Terje’s Cryptoanalysis.............................................................................................................51
3.11.1. Rules...........................................................................................................................................................................................................51
3.11.2. Solutions.....................................................................................................................................................................................................52
3.12. Ton’s Maxigolf 1 "Stones"......................................................................................................52
3.12.1. Rules...........................................................................................................................................................................................................52
3.12.2. Solutions.....................................................................................................................................................................................................53
3.13. Ton’s Maxigolf 2 "Map coloring"...........................................................................................54
3.13.1. Rules...........................................................................................................................................................................................................54
3.13.2. Solutions.....................................................................................................................................................................................................55
3.14. Ton’s Minigolf 3 “Boxes”.......................................................................................................56
3.14.1. Rules...........................................................................................................................................................................................................56
3.14.2. Solutions.....................................................................................................................................................................................................57
3.15. Ton’s Minigolf 4 "Missing Numbers"....................................................................................58
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 3 of 520
3.15.1. Rules...........................................................................................................................................................................................................58
3.15.2. Solutions.....................................................................................................................................................................................................59
4.
Games - TPR................................................................................................................................61
4.1.
TPR(0,0) "Base 36 Converter"................................................................................................61
4.1.1.
Rules...........................................................................................................................................................................................................61
4.1.2.
Solutions.....................................................................................................................................................................................................61
4.2.
TPR(0,1) "Numerology".........................................................................................................61
4.2.1.
Rules...........................................................................................................................................................................................................61
4.2.2.
Solutions.....................................................................................................................................................................................................62
4.3.
TPR(0,2) "Anagrams".............................................................................................................62
4.3.1.
Rules...........................................................................................................................................................................................................62
4.3.2.
Solutions.....................................................................................................................................................................................................63
4.3.3.
Artistic/Unorthodox Solutions....................................................................................................................................................................73
4.3.4.
Explanation by Lars Mathiesen...................................................................................................................................................................74
4.4.
TPR(0,3) "Mathemathics".......................................................................................................77
4.4.1.
Rules...........................................................................................................................................................................................................78
4.4.2.
Solutions “Cantor”......................................................................................................................................................................................78
4.4.3.
Artistic/Unorthodox Solutions “Cantor”.....................................................................................................................................................87
4.4.4.
Solutions “Kolakoski”................................................................................................................................................................................92
4.4.5.
Artistic/Unorthodox Solutions “Kolakoski”.............................................................................................................................................100
4.4.6.
Explanation by Ton Hospel......................................................................................................................................................................104
4.4.7.
Explanation by Rick Klement...................................................................................................................................................................104
4.4.8.
Explanation by Mtv Europe......................................................................................................................................................................107
4.4.9.
Multilingual Solution by Jérôme Quelin...................................................................................................................................................109
4.5.
TPR(0,4) "Interlinear Counts"...............................................................................................120
4.5.1.
Rules.........................................................................................................................................................................................................120
4.5.2.
Solutions...................................................................................................................................................................................................121
4.5.3.
Artistic/Unorthodox Solutions..................................................................................................................................................................130
4.6.
TPR(0,4b) "Topological Sort"...............................................................................................133
4.6.1.
Rules.........................................................................................................................................................................................................133
4.6.2.
Solutions...................................................................................................................................................................................................134
4.6.3.
Artistic/Unorthodox Solutions..................................................................................................................................................................140
4.6.4.
Explanation by Chris Dolan......................................................................................................................................................................140
4.6.5.
Explanation by Ton Hospel......................................................................................................................................................................143
4.7.
TPR(0,4c) "Ciphers and Letters"..........................................................................................145
4.7.1.
Rules.........................................................................................................................................................................................................145
4.7.2.
Solutions Hole 1 (Factorial)......................................................................................................................................................................146
4.7.3.
Artistic/Unorthodox Solutions Hole 1 (Factorial).....................................................................................................................................149
4.7.4.
Solutions Hole 2 (Postorder).....................................................................................................................................................................150
4.7.5.
Artistic/Unorthodox Solutions Hole 2 (Postorder)....................................................................................................................................154
4.7.6.
Explanation by Stephen Turner.................................................................................................................................................................154
4.8.
TPR(0,5a) "Infix to RPN".....................................................................................................156
4.8.1.
Rules.........................................................................................................................................................................................................156
4.8.2.
Solutions...................................................................................................................................................................................................157
4.8.3.
Artistic/Unorthodox Solutions..................................................................................................................................................................162
4.8.4.
Explanation by Michael Thelen................................................................................................................................................................163
4.8.5.
Explanation by Eugene van der Pijll.........................................................................................................................................................164
4.9.
TPR(0,5b) "String to Number"..............................................................................................166
4.9.1.
Rules.........................................................................................................................................................................................................166
4.9.2.
Solutions...................................................................................................................................................................................................167
4.9.3.
Artistic/Unorthodox Solutions..................................................................................................................................................................174
4.9.4.
Explanation by Ton Hospel......................................................................................................................................................................174
4.10. TPR(0,6) "The Burrows-Wheeler Transform"......................................................................178
4.10.1. Rules.........................................................................................................................................................................................................179
4.10.2. Solutions...................................................................................................................................................................................................183
4.10.3. Artistic/Unorthodox Solutions..................................................................................................................................................................187
5.
Games - Terje’s PGAS season 0...............................................................................................188
5.1.
The Archeologists' Dilemma.................................................................................................188
5.1.1.
Rules.........................................................................................................................................................................................................188
5.1.2.
Solutions...................................................................................................................................................................................................188
5.2.
Godzillagolf "Laser Beam"...................................................................................................190
5.2.1.
Rules.........................................................................................................................................................................................................190
5.2.2.
Solutions...................................................................................................................................................................................................191
5.3.
Rotating sentences.................................................................................................................192
5.3.1.
Rules.........................................................................................................................................................................................................192
5.3.2.
Solutions...................................................................................................................................................................................................192
5.4.
Eggtimer................................................................................................................................194
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 4 of 520
5.4.1.
Rules.........................................................................................................................................................................................................194
5.4.2.
Solutions...................................................................................................................................................................................................194
5.5.
Forth......................................................................................................................................195
5.5.1.
Rules.........................................................................................................................................................................................................195
5.5.2.
Solutions...................................................................................................................................................................................................197
5.6.
Ordered fractions...................................................................................................................198
5.6.1.
Rules.........................................................................................................................................................................................................198
5.6.2.
Solutions...................................................................................................................................................................................................198
5.7.
Power Crisis..........................................................................................................................200
5.7.1.
Rules.........................................................................................................................................................................................................200
5.7.2.
Solutions...................................................................................................................................................................................................200
5.8.
Starmap..................................................................................................................................202
5.8.1.
Rules.........................................................................................................................................................................................................203
5.8.2.
Solutions...................................................................................................................................................................................................203
5.9.
Cantor's revenge....................................................................................................................204
5.9.1.
Rules.........................................................................................................................................................................................................204
5.9.2.
Solutions...................................................................................................................................................................................................205
5.10. Add 11...................................................................................................................................208
5.10.1. Rules.........................................................................................................................................................................................................209
5.10.2. Solutions...................................................................................................................................................................................................209
5.11. Go golf...................................................................................................................................211
5.11.1. Rules.........................................................................................................................................................................................................211
5.11.2. Solutions...................................................................................................................................................................................................212
5.12. Modular Fibonacci................................................................................................................213
5.12.1. Rules.........................................................................................................................................................................................................213
5.12.2. Solutions...................................................................................................................................................................................................213
5.13. Self numbers..........................................................................................................................215
5.13.1. Rules.........................................................................................................................................................................................................215
5.13.2. Solutions...................................................................................................................................................................................................215
5.14. Spinning wheels....................................................................................................................218
5.14.1. Rules.........................................................................................................................................................................................................218
5.14.2. Solutions...................................................................................................................................................................................................219
5.15. Columns squeezer.................................................................................................................219
5.15.1. Rules.........................................................................................................................................................................................................220
5.15.2. Solutions...................................................................................................................................................................................................220
5.16. DNA sorting..........................................................................................................................221
5.16.1. Rules.........................................................................................................................................................................................................221
5.16.2. Solutions...................................................................................................................................................................................................221
5.17. Clock patience.......................................................................................................................223
5.17.1. Rules.........................................................................................................................................................................................................223
5.17.2. Solutions...................................................................................................................................................................................................224
5.18. Ideal golf...............................................................................................................................226
5.18.1. Rules.........................................................................................................................................................................................................226
5.18.2. Solutions...................................................................................................................................................................................................228
5.19. Scrabble.................................................................................................................................230
5.19.1. Rules.........................................................................................................................................................................................................230
5.19.2. Solutions...................................................................................................................................................................................................230
5.20. "LED" Display......................................................................................................................232
5.20.1. Rules.........................................................................................................................................................................................................232
5.20.2. Solutions...................................................................................................................................................................................................233
5.21. Spiral.....................................................................................................................................238
5.21.1. Rules.........................................................................................................................................................................................................238
5.21.2. Solutions...................................................................................................................................................................................................239
5.22. Card trick...............................................................................................................................242
5.22.1. Rules.........................................................................................................................................................................................................242
5.22.2. Solutions...................................................................................................................................................................................................243
5.23. Ascii......................................................................................................................................245
5.23.1. Rules.........................................................................................................................................................................................................245
5.23.2. Solutions...................................................................................................................................................................................................245
5.24. Soundex.................................................................................................................................248
5.24.1. Rules.........................................................................................................................................................................................................248
5.24.2. Solutions...................................................................................................................................................................................................249
5.25. Isometric boxes.....................................................................................................................252
5.25.1. Rules.........................................................................................................................................................................................................252
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 5 of 520
5.25.2. Solutions...................................................................................................................................................................................................253
5.26. All roads leads where ?.........................................................................................................257
5.26.1. Rules.........................................................................................................................................................................................................257
5.26.2. Solutions...................................................................................................................................................................................................258
5.27. Crossing (s)words..................................................................................................................260
5.27.1. Rules.........................................................................................................................................................................................................260
5.27.2. Solutions...................................................................................................................................................................................................261
5.28. Rough Flying.........................................................................................................................263
5.28.1. Rules.........................................................................................................................................................................................................263
5.28.2. Solutions...................................................................................................................................................................................................263
5.29. Digit sums.............................................................................................................................266
5.29.1. Rules.........................................................................................................................................................................................................266
5.29.2. Solutions...................................................................................................................................................................................................267
5.30. Minesweeper.........................................................................................................................268
5.30.1. Rules.........................................................................................................................................................................................................268
5.30.2. Solutions...................................................................................................................................................................................................269
5.31. Linear Cellular Automata......................................................................................................271
5.31.1. Rules.........................................................................................................................................................................................................271
5.31.2. Solutions...................................................................................................................................................................................................272
5.32. Motley boxes.........................................................................................................................274
5.32.1. Rules.........................................................................................................................................................................................................274
5.32.2. Solutions...................................................................................................................................................................................................275
5.33. Hamming sequence...............................................................................................................278
5.33.1. Rules.........................................................................................................................................................................................................278
5.33.2. Solutions...................................................................................................................................................................................................279
5.34. Vigenere Cipher....................................................................................................................282
5.34.1. Rules.........................................................................................................................................................................................................282
5.34.2. Solutions...................................................................................................................................................................................................284
5.35. Musical Notes........................................................................................................................286
5.35.1. Rules.........................................................................................................................................................................................................287
5.35.2. Solutions...................................................................................................................................................................................................287
5.36. Strange Numbers...................................................................................................................290
5.36.1. Rules.........................................................................................................................................................................................................290
5.36.2. Solutions...................................................................................................................................................................................................290
6.
Games - Terje’s PGAS season 1...............................................................................................293
6.1.
Candy bags............................................................................................................................293
6.1.1.
Rules.........................................................................................................................................................................................................293
6.1.2.
Solutions...................................................................................................................................................................................................294
6.1.3.
Explanation by Ton Hospel......................................................................................................................................................................296
6.2.
Boggle...................................................................................................................................299
6.2.1.
Rules.........................................................................................................................................................................................................299
6.2.2.
Solutions...................................................................................................................................................................................................300
6.2.3.
Explanation...............................................................................................................................................................................................302
6.3.
Palindrome............................................................................................................................305
6.3.1.
Rules.........................................................................................................................................................................................................305
6.3.2.
Solutions...................................................................................................................................................................................................306
6.4.
Mathematical forest...............................................................................................................308
6.4.1.
Rules.........................................................................................................................................................................................................308
6.4.2.
Solutions...................................................................................................................................................................................................309
6.5.
Goldbach's Conjecture..........................................................................................................311
6.5.1.
Rules.........................................................................................................................................................................................................311
6.5.2.
Solutions...................................................................................................................................................................................................312
6.6.
Automatic Editing.................................................................................................................313
6.6.1.
Rules.........................................................................................................................................................................................................313
6.6.2.
Solutions...................................................................................................................................................................................................315
6.7.
Align 2...................................................................................................................................317
6.7.1.
Rules.........................................................................................................................................................................................................318
6.7.2.
Solutions...................................................................................................................................................................................................318
6.8.
Perl Bowling..........................................................................................................................320
6.8.1.
Rules.........................................................................................................................................................................................................320
6.8.2.
Solutions...................................................................................................................................................................................................320
6.9.
Huffman codes......................................................................................................................321
6.9.1.
Rules.........................................................................................................................................................................................................322
6.9.2.
Solutions...................................................................................................................................................................................................325
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 6 of 520
6.10. PERT/Gantt chart conversion................................................................................................327
6.10.1. Rules.........................................................................................................................................................................................................327
6.10.2. Solutions...................................................................................................................................................................................................328
6.11. LED reader............................................................................................................................330
6.11.1. Rules.........................................................................................................................................................................................................330
6.11.2. Solutions...................................................................................................................................................................................................330
6.11.3. Explanation by Juho Snellman..................................................................................................................................................................332
6.12. Reversi - Yet Another 2D Perl Golf......................................................................................333
6.12.1. Rules.........................................................................................................................................................................................................333
6.12.2. Solutions...................................................................................................................................................................................................334
6.13. Entropy compress..................................................................................................................336
6.13.1. Rules.........................................................................................................................................................................................................336
6.13.2. Solutions...................................................................................................................................................................................................337
6.14. Matcher..................................................................................................................................339
6.14.1. Rules.........................................................................................................................................................................................................339
6.14.2. Solutions...................................................................................................................................................................................................340
6.15. Nim........................................................................................................................................341
6.15.1. Rules.........................................................................................................................................................................................................342
6.15.2. Solutions...................................................................................................................................................................................................343
6.16. Josephus Problem..................................................................................................................344
6.16.1. Rules.........................................................................................................................................................................................................344
6.16.2. Solutions...................................................................................................................................................................................................344
6.17. Unfragment............................................................................................................................346
6.17.1. Rules.........................................................................................................................................................................................................346
6.17.2. Solutions...................................................................................................................................................................................................346
6.18. Permutations..........................................................................................................................349
6.18.1. Rules.........................................................................................................................................................................................................349
6.18.2. Solutions...................................................................................................................................................................................................349
6.19. A1227....................................................................................................................................351
6.19.1. Rules.........................................................................................................................................................................................................351
6.19.2. Solutions...................................................................................................................................................................................................351
6.19.3. Explanation by Ton Hospel......................................................................................................................................................................353
6.20. Loopy....................................................................................................................................354
6.20.1. Rules.........................................................................................................................................................................................................354
6.20.2. Solutions...................................................................................................................................................................................................355
6.21. Card Trick 2..........................................................................................................................356
6.21.1. Rules.........................................................................................................................................................................................................356
6.21.2. Solutions...................................................................................................................................................................................................357
6.22. Subproduct............................................................................................................................358
6.22.1. Rules.........................................................................................................................................................................................................358
6.22.2. Solutions...................................................................................................................................................................................................359
6.23. Regex simplification.............................................................................................................360
6.23.1. Rules.........................................................................................................................................................................................................360
6.23.2. Solutions...................................................................................................................................................................................................361
6.24. Matrix....................................................................................................................................361
6.24.1. Rules.........................................................................................................................................................................................................362
6.24.2. Solutions...................................................................................................................................................................................................362
6.25. Shadow..................................................................................................................................363
6.25.1. Rules.........................................................................................................................................................................................................363
6.25.2. Solutions...................................................................................................................................................................................................365
6.26. Mayan number converter......................................................................................................366
6.26.1. Rules.........................................................................................................................................................................................................366
6.26.2. Solutions...................................................................................................................................................................................................366
6.27. Rush Hour.............................................................................................................................369
6.27.1. Rules.........................................................................................................................................................................................................369
6.27.2. Solutions...................................................................................................................................................................................................373
6.28. Balanced Ternary Addition...................................................................................................374
6.28.1. Rules.........................................................................................................................................................................................................375
6.28.2. Solutions...................................................................................................................................................................................................376
6.29. Mastermind............................................................................................................................377
6.29.1. Rules.........................................................................................................................................................................................................377
6.29.2. Solutions...................................................................................................................................................................................................378
6.30. Triangles................................................................................................................................379
6.30.1. Rules.........................................................................................................................................................................................................379
Perlgolf History
Edition 2007-01-09
top secret / strictly confidential
page 7 of 520
6.30.2. Solutions...................................................................................................................................................................................................380
6.31. Tennis Scoresheet..................................................................................................................382
6.31.1. Rules.........................................................................................................................................................................................................382
6.31.2. Solutions...................................................................................................................................................................................................383
7.
Games - Terje’s PGAS season 2...............................................................................................385
7.1.
Beads.....................................................................................................................................385
7.1.1.
Rules.........................................................................................................................................................................................................385
7.1.2.
Solutions...................................................................................................................................................................................................385
8.
Games - Kernelpanic season 1.................................................................................................387
8.1.
PCLP #4 - GRAY CMP........................................................................................................387
8.1.1.
Solutions...................................................................................................................................................................................................387
8.2.
PCLP #5b – SAPER..............................................................................................................387
8.2.1.
Solutions...................................................................................................................................................................................................388
8.3.
PCLP #6 – SPIRALA............................................................................................................388
8.3.1.
Solutions...................................................................................................................................................................................................388
8.4.
PCLP #7 – KOMIWOJAŻER...............................................................................................389
8.4.1.
Solutions...................................................................................................................................................................................................389
8.5.
PCLP #8 – SZACHY............................................................................................................390
8.5.1.
Solutions...................................................................................................................................................................................................390
8.6.
PCLP #9 - KWADRATY.................................
- 上一篇: sonar-Web_JavaScript检查规则指南.docx
- 下一篇: Sonar中文语言包