AdventOfCode
1.0.0
該存儲庫包含我使用常見的LISP對代碼難題出現的實現。並不是說我為分享它們而感到自豪,這更像是我玩得開心,我可能會通過公開此代碼來學習新技巧。
我打算玩這款遊戲的是要玩得開心,並迅速做拼圖。我不會在這裡擴展有關編程最佳實踐的任何嚴肅的事情,因此它大多會表現出我自己的反射和習慣。否則它不再有趣了,是嗎?
我準備了一些工具,以在此處輸出拼圖計時和結果的摘要,以供有興趣的讀者快速概述。我的打算是將其保持為每天再次運行的數據。
我正在為這些黑客使用Clozure Common LISP版本1.12-DEV DARWINX8664,眾所周知,SBCL可能會增強結果,或者在其他情況下,可能ECL或剪輯甚至更快。我應該在乎嗎?好吧,我當然不會。
PARSER> (advent/2018:summary)
Day 1: Chronal Calibration
Puzzle 1: sum of frequency changes
3.958ms 520
Puzzle 2: first frequency read twice
699.040ms 394
Day 2: Inventory Management System
Puzzle 1: checksum of box ids
4.857ms 5000
Puzzle 2: common letters in box ids one letter apart
9.060ms ymdrchgpvwfloluktajxijsqmb
Day 3: No Matter How You Slice It
Puzzle 1: find squares claimed more than once
819.373ms 101565
Puzzle 2: find the only claim asked of only once
739.283ms 656
Day 4: Repose Record
Puzzle 1: Most Sleepy Guard, Strategy 1
5.472ms 35623
Puzzle 2: Minute Most Slept by a single guard, Strategy 2
7.761ms 23037
Day 5: Alchemical Reduction
Puzzle 1: Polymer reactions
2.609ms 10250
Puzzle 2: Time to improve the polymer.
100.259ms 6188
Day 6: Chronal Coordinates
Puzzle 1: dangerous, keep away, largest finite area
2132.732ms 4342
Puzzle 2: safe, keep close, within manhattan sum threshold
445.090ms 42966
Day 7: The Sum of Its Parts
Puzzle 1: order instruction steps (dependency graph)
0.330ms ABLCFNSXZPRHVEGUYKDIMQTWJO
Puzzle 2: time to complete steps in parallel with 5 workers
1.728ms 1157
Day 8: Memory Maneuver
Puzzle 1: read software license file
4.990ms 40701
Puzzle 2: value of the root node
2.295ms 21399
Day 9: Marble Mania
Puzzle 1: What is the winning Elf's score?
31.307ms 385820
Puzzle 2: What is the score with 100 times as many marbles?
5293.371ms 3156297594
Day 10: The Stars Align
Puzzle 1: KFLBHXGK
Puzzle 2: 10659s
Day 11: Chronal Charge
Puzzle 1: Find the 3x3 square with the largest total power
22.850ms 243,34
Puzzle 2: Find the square with the largest total power
413351.220ms 90,214,15
Day 12: Subterranean Sustainability
Puzzle 1: sum of indexes of pots with plants after 20 generations
2.283ms 2736
Puzzle 2: sum of indexes of pots with plants after 50000000000 generations
18.050ms 3150000000905
Day 14: Chocolate Charts
Puzzle 1: scores of the ten recipes immediately after 323081
139.835ms 7162937112
Puzzle 2: how many recipes to the left of 323081
12671.771ms 20195890
Day 15: Beverage Bandits
TO BE DONE LATER, lacking motivation for this one at the moment
Day 16: Chronal Classification
Puzzle 1: Count samples matching exactly 3 opcodes
20.406ms 529
Puzzle 2: Run given program with found opcodes
13.033ms 573
僅僅是為了踢它,而且由於我如今與普通LISP的GUI工具包McClim一起玩,這是我在64條常見的LISP代碼中迅速進行的可視化面料拼圖:
這次,我有一個錯誤,可以找到正確的測試結果,但在給出輸入時找不到正確的結果。那讓我感到困惑。我決定要畫2D區域以獲取線索。哦,現在很明顯,邊界框計算是錯誤的。修復此問題,重新計算,良好的結果!
感謝麥克林再次使我的生活變得輕鬆;-)
這個難題是非常視覺的,因為您需要模擬恆星運動,直到您可以讀取星星形成的一些字母,就像它們是顯示器上的像素一樣。你說的視覺嗎?麥克林再次營救!
這次,不僅可以提供拼圖的確認或調試能力,還可以使用可視化來解決難題。我互動地進行了時間,並報告了我點擊快進的按鈕的時間數,直到我擁有完美的框架!