Writing a very basic command-line tic-tac-toe game in Zig as a way of learning the very basics of the language. I also wrote a blog post about this project.
Previously, I did this in Rust and Go as a learning exercise in those two languages.
Consult the Zig GitHub README for installation options.
I think I installed Zig by running: snap install zig --classic --edge
, as listed in Zig's GitHub wiki. I originally wrote this program running v0.9.1.
Once Zig is installed, you should be able to run this program with the following command:
zig build run
This program should work with Zig version 0.13.0, though I haven't tested it thoroughly.
Note that most of the code work is in src/main.zig
.
These are potentially out-dated now, but here are some things I used in 2022:
- Official Zig docs for current version of Zig
- Official Zig docs for v 0.9.1
- ziglearn.org
- Zig by example
- Ziglings (think this requires an edge version of Zig?)
- A long video of a beginner Zig programmer who's coming from Rust
Just a note to myself:
test "basic test" {
try std.testing.expectEqual(10, 3 + 7);
}