Function to play Peg Solitaire.
A valid move is to jump a peg orthogonally over an adjacent peg into a hole two positions away and then to remove the jumped peg. The game is over when no moves are possible. The goal is to have the lower number peg at the end.
To play, install the package using the
install_github() function of
library(devtools) install_github("2pie/Peg-Solitaire") library(solitaire) solitaire()
... or simply run the file solitaire.R in R.
Start the game by writing
solitaire() in the console.