- Strive for code readability
- Minimize dependency on obscure libraries
- Avoid language extensions when possible
- Each file is self-contained
- Optimize performance without compromising readability
You may need following dependencies:
sudo apt install libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev libxext-dev libgmp-dev z3This project uses Stack for building and compilation.
Build:
For windows:
chcp 65001; stack buildOther platform:
stack buildTo run the second problem of Day 6 (2024) with input from inputs/2024/input6.txt:
stack run 2024 6 2To run the first problem of Day 1 (2024) with test input from inputs/2024/test1.txt:
stack run 2024 1 1 testSome solutions feature animation demonstrations:
- Problem 1 animation corresponds to problem ID 3
- Problem 2 animation corresponds to problem ID 4
- Frame per second (FPS) can be specified (default: 1 FPS)
Example 1: Run animation for 2024 Day 15 Problem 2 with test input (2 FPS):
stack run 2024 15 4 test 2Example 2: Run animation for 2024 Day 15 Problem 1 with regular input (2 FPS):
stack run 2024 15 3 2Animation can be controlled by following keys:
- Arrow keys: Move around
-/=key: Zoom out and Zoom in
Some questions have two versions, you can use following commands to run second version:
stack run -- 2025 10 -1 # second version of Year 2025 Day 10 first question
stack run -- 2025 10 -2 # second version of Year 2025 Day 10 second questionThis is my Bilibili video record of the solutions.
- 代码尽量保证可读性
- 尽量不依赖于冷门的库
- 尽量不使用语言扩展
- 每个文件是独立的
- 尽量在不影响可读性的前提下提高代码性能
可能需要安装以下依赖:
sudo apt install libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev libxext-dev libgmp-dev z3本项目依靠 stack 构建与编译
编译:
Windows 平台:
chcp 65001; stack build其他平台:
stack build运行以下命令,将运行2024年第6天的第二道题目,题目输入为 inputs/2024/input6.txt:
stack run 2024 6 2运行以下命令,将运行2024年第1天的第一道题目,题目输入为测试输入,即 inputs/2024/test1.txt:
stack run 2024 1 1 test部分程序拥有动画演示功能,1、2题的动画演示分别对应的题目编号为3、4,此外,动画演示程序可以指定每秒多少帧(FPS),如不指定,默认为每秒1帧。例如,运行以下命令,会运行2024年第15天第二题的动画演示,2 FPS,输入为测试输入:
stack run 2024 15 4 test 2运行以下命令,会运行第15天第一道题目的动画演示,2 FPS,非测试输入内容:
stack run 2024 15 3 2动画可以用以下按键来控制:
- 方向键: 移动视角
-或者=: 缩放视角
一些问题会存在两个版本,可以使用以下命令运行第二个版本:
stack run -- 2025 10 -1 # 运行2025年第10天第一题的第二个版本
stack run -- 2025 10 -2 # 运行2025年第10天第二题的第二个版本这是我的B站视频记录。