Skip to content

abdrd/peg-solitaire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peg solitaire

Peg Solitaire in the terminal.

I assume you know the rules.

How to move pegs

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<
  • D2v
  • 2 d v
  • 3B >

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.

Flags

You can specify how big you want the board to be rendered.

Pass the scale flag with a payload of

  • small
  • normal or
  • big

The default scale is normal.

Running the game

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
        
    • Or just start the game without building

      go run .
    

Contribute

Read TODO.md for feature ideas.

Contributions for bug fixes, code improvements, or new ideas etc. are also welcome.

License

MIT

About

Peg Solitaire in the terminal

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages