Peg Solitaire in the terminal.
I assume you know the rules.
The syntax is <pos> <direction> where pos is an order-independent combination of
a <col> (a case-insensitive letter in the range A-Z)
and
a <row> (a number in the range 1-26)
and direction is a symbol representing the move direction of the peg located at pos
which can be one of the following:
>(right)<(left)^(up)v(down)
Here are some example moves:
f4<4f<D2v2 d v3B >
Validity of a move also depends on the shape of the board. Even though a move like d7< is
syntactically correct, it is not a legal move on an English board.
You can specify how big you want the board to be rendered.
Pass the scale flag with a payload of
smallnormalorbig
The default scale is normal.
I wrote the game in Go 1.24, but you should be able to build it with Go 1.22+.
- Clone the repository
git clone https://github.com/abdrd/peg-solitaire- Change directory
cd peg-solitaire- Either
-
Build
go build -o solitaire .- Run
./solitaire - Install (optional)
go install solitaire
- Run
-
Or just start the game without building
go run . -
Read TODO.md for feature ideas.
Contributions for bug fixes, code improvements, or new ideas etc. are also welcome.
MIT