Skip to content

Commit 5fce70c

Browse files
committed
Improve usage instructions
1 parent e3a92c6 commit 5fce70c

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

21.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ var (grid, quantumGrid) = readInput()
294294
// let p1 = grid.reachable
295295
// print(p1)
296296

297-
quantumMove(grid: &quantumGrid, steps: 10)
297+
quantumMove(grid: &quantumGrid, steps: 6)
298298
let p2 = quantumGrid.reachable
299299
print(quantumGrid)
300300
print(p2)

README.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
1-
Haskell¹ solutions to [Advent of Code 2023](https://adventofcode.com/2023).
1+
Haskell and Swift¹ solutions to [Advent of Code 2023](https://adventofcode.com/2023).
2+
3+
Each solution is in a self-contained file with zero dependencies that can be
4+
run directly by the stock Haskell and Swift compilers. For example:
5+
6+
cat examples/18 | runghc 18.hs
7+
cat examples/18 | swift 18.swift
8+
9+
More details about running, including some convenient `make` invocations, are
10+
described below.
211

312
<small>¹ The primary solutions are is Haskell. But for some problems, I've also
4-
done variations using other means and languages. </small>
13+
done variations using other means and languages, mostly Swift.</small>
514

615
## Running
716

8-
Install [Haskell using GHCup](https://www.haskell.org/ghcup/). Then, to run the
9-
latest solution on the latest of its example inputs, use
17+
Install [Haskell using GHCup](https://www.haskell.org/ghcup/), or
18+
[Swift](https://swift.org), depending on which solutions you want to run.
19+
20+
Then, to run the latest solution on the latest of its example inputs, use
1021

1122
make
1223

1324
Other commands:
1425

1526
- `make test` – run on the actual input, and compare against the expected
16-
answers.
17-
- `make o` - same as `make test`, but first compile the .hs file using GHC
18-
with optimizations enabled. There's also a `make o2` variant of this.
27+
answers. The actual inputs should be in `input/xx`, and the expected answers
28+
in `answers/xx-a` and `answers/xx-b`.
29+
- `make o` - same as `make test`, but first compile the file using `ghc` or
30+
`swiftc` with optimizations enabled. There's also a `make o2` variant of
31+
this for Haskell that uses the `-O2` level.
1932
- `make verify` - Run `make test`, but for all days so far, in reverse. Print
2033
nice and pretty stats about all the days too.
2134
- `make clean` - Clean temporary files (written to `out/`).
2235

2336
To run the command on a specific day's program, just `touch` it so that it has
24-
the latest modification time - subsequent make invocations will pick it.
37+
the latest modification time - subsequent make invocations will pick it. So for
38+
example, if I wanted to run day 18, I can
2539

26-
All of these are wrappers around the basic pattern of
40+
touch 18.swift # or touch 18.hs, depending on which I wish to run
41+
make
42+
43+
All of make invocations are wrappers around the basic pattern of
2744

2845
cat somefile | runghc xx.hs
2946

47+
and
48+
49+
cat somefile | swift xx.swift
50+
3051
Some of the solutions are done in shell scripts. To run these, the filename
3152
needs to be passed to the script instead of passing the input via stdin:
3253

0 commit comments

Comments
 (0)