Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

anakojm/peg-solitaire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peg solitaire

A game of peg solitaire in the terminal, written in python


  • Select "from" with the arrow keys or hjkl, confirm with enter or space
  • Cancel by reselecting "from" and confirming with enter or space
  • Select "to" with the arrow keys or hjkl, confirm with enter or space
  • Quit anytime with escape, q or m
  • You can switch between the European and the English version by switching a boolean in the code, a custom board is also possible.
  • You can save a game with s or J, you can't save a game after selecting a peg, for technical reasons (I suck a programming), you can cancel saving by inputting a blank file
  • You can load a game with L, you can cancel loading by inputting a blank file
  • All the keybinds are easily configurable in the code

UI: · indicates a peg in a hole, * emboldened indicates the peg to be moved, and o indicates an empty hole. A blue ¤ is the hole the current peg moved from; a red * is the final position of that peg, a red o is the hole of the peg that was jumped and removed.


The goal of the game is to empty the board except for one center peg.

To reach that goal you can move a piece. You can only move a piece by "jumping" over another one, "eating" it in the process.

The destination must be empty.


Screenshot:

UI showcase


TODO: grep "TODO" peg_solitaire.py

Thank you to u/RiceKrispyPooHead and mason1920 for their help!