Implement safe cracking logic and setup development environment
- Added a new `main.cpp` file with logic to parse dial rotations from a file and execute safe cracking based on the parsed data. - Introduced a `DialRotation` struct to represent the direction and distance of dial rotations. - Implemented `parseRotations` function to read and parse input from a specified file, returning a vector of `DialRotation` or an error message. - Created `executeSafeCrack` function to process the dial rotations and print the current state of the dial. - Added `.clang-format` and `.clang-tidy` configuration files for code formatting and linting. - Set up a Dockerfile for a development container with necessary tools and dependencies. - Configured VS Code settings and tasks for building, formatting, and running clang-tidy. - Added a script to run clang-tidy on the source files, ensuring code quality.
This commit is contained in:
parent
c093e8a4bf
commit
38eca3b747
11 changed files with 4654 additions and 3 deletions
23
.devcontainer/Dockerfile
Normal file
23
.devcontainer/Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
FROM xianpengshen/clang-tools:21
|
||||
|
||||
# Install development tools (cmake, ninja, build essentials)
|
||||
USER root
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
cmake \
|
||||
ninja-build \
|
||||
build-essential \
|
||||
git \
|
||||
python3 \
|
||||
python3-pip \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create workspace folder (VS Code devcontainer convention)
|
||||
ARG WORKSPACE_FOLDER=/workspaces/aoc25
|
||||
RUN mkdir -p ${WORKSPACE_FOLDER} && chown -R root:root ${WORKSPACE_FOLDER}
|
||||
WORKDIR ${WORKSPACE_FOLDER}
|
||||
|
||||
ENV SHELL=/bin/bash
|
||||
|
||||
CMD ["bash"]
|
||||
20
.devcontainer/devcontainer.json
Normal file
20
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "aoc25-clang21",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile"
|
||||
},
|
||||
"workspaceFolder": "/workspaces/aoc25",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/aoc25,type=bind,consistency=cached",
|
||||
"settings": {
|
||||
"C_Cpp.default.compilerPath": "/usr/bin/clang++-21",
|
||||
"C_Cpp.default.intelliSenseMode": "linux-clang-x64",
|
||||
"clang-format.executable": "/usr/bin/clang-format-21"
|
||||
},
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cmake-tools",
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
"xaver.clang-format"
|
||||
],
|
||||
"postCreateCommand": "cmake -S . -B build || true"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue