5x5 Square Peg Solitaire Interactive Game
Loading the math board and drawing, please wait…
In collections
Math Games with GeoGebra (GGB)
This GeoGebra applet demonstrates a 5x5 square board Peg Solitaire game, also known as Independent Diamond Chess. The model uses the Polygon command to construct the board background and edges, and generates 25 holes and checkers using Circle and Sequence commands. Users can interactively play the game by jumping checkers over adjacent pieces into empty holes, following the classic rules of Peg Solitaire. The system records each move in a Gamelog, providing a complete history of gameplay, and supports a one-click restart button (buttonRestart) for convenient replay. This example is not only a classic logic puzzle game that challenges players to reduce all pegs on the board to a single remaining piece, but it also vividly showcases how to leverage GeoGebra's geometric construction and sequence functionalities to develop complex interactive board games. Students benefit from engaging with an authentic mathematical puzzle that requires strategic thinking, spatial reasoning, and systematic problem-solving. The interactive nature of the applet allows learners to experiment with different jump sequences, observe patterns in successful and failed attempts, and develop intuition for combinatorial reasoning. By combining visual geometry tools with logical gameplay mechanics, this applet serves as an excellent bridge between recreational mathematics and computational thinking, demonstrating the versatility of GeoGebra as both a geometry tool and a game development platform.
GeoGebra Commands & Parameters
Circle((-1, 2), r) → c4Circle((0, 2), r) → c5Circle((1, 2), r) → c6Circle((-2, 1), r) → c8Circle((-1, 1), r) → c9Circle((0, 1), r) → c10Circle((1, 1), r) → c11Circle((2, 1), r) → c12Circle((-2, 0), r) → c15Circle((-1, 0), r) → c16Circle((0, 0), r) → c17Circle((1, 0), r) → c18Circle((2, 0), r) → c19Circle((-2, -1), r) → c22Circle((-1, -1), r) → c23Circle((0, -1), r) → c24Circle((1, -1), r) → c25Circle((2, -1), r) → c26Circle((3, -1), r) → c27Circle((-1, -2), r) → c28Circle((0, -2), r) → c29Polygon({(-2, -3), (2, -3), (3, -2), (3, 2), (2, 3), (-2, 3), (-3, 2), (-3, -2)}) → polyBoardCircle((1, -2), r) → c30Intersection(focusongo, spaces) → spacesgo1Polygon({(-2, -3), (2, -3), (3, -2), (3, 2), (2, 3), (-2, 3), (-3, 2), (-3, -2)}) → polyBoardEdgeRemoveUndefined(Sequence[If[(focuson(1) + spacesgo1(k)) / 2 ∈ checkers, spacesgo1(k)], k, 1, Length[spacesgo1]]) → spacesgoPolygon({Corner[1], Corner[2], Corner[3], Corner[4]}) → polyBackgroundLength(checkers) → numRLength(Gamelog) → nGLSequence(Circle[checkers(k), 0.375], k, 1, Length[checkers]) → checkersCSequence(Circle[spacesgo(k), 0.375], k, 1, Length[spacesgo]) → spacesgoCSequence(Circle[spaces(k), 0.375], k, 1, Length[spaces]) → spacesCPolygon({Corner[1], Corner[2], Corner[3], Corner[4]}) → polyMaskUnique(Flatten[Sequence[{If[checkers(k) + (1, 0) ∈ checkers, checkers(k) + (2, 0)], If[checkers(k) + (-1, 0) ∈ checkers, checkers(k) + (-2, 0)], If[checkers(k) + (0, -1) ∈ checkers, checkers(k) + (0, -2)], If[checkers(k) + (0, 1) ∈ checkers, checkers(k) + (0, 2)]}, k, 1, Length[checkers]]]) → allcheckersgoIntersection(allcheckersgo, spaces) → allgoCircle((2, -2), r) → c37Circle((-2, -2), r) → c36Polygon({(-1.3, -5), (1.3, -5), (1.3, -1.7), (-1.3, -1.7)}) → polyPatternCircle((2, 2), r) → c35Circle((-2, 2), r) → c34Sequence(Translate[picMarble, Vector[A, checkers(k) + (-0.375, -0.375)]], k, 1, Length[checkers]) → checkersM
AI Drawing Prompt Reference
Draw a 5x5 square grid board with 25 circular checkers and 36 circular holes. The board background is a white square, with a black border. The radius of the checkers and holes is 0.375. The checkers are arranged in the square cells of the board, with holes in between. There is a black triangular pattern above the board.
The prompt above was compiled from the original drawing commands and is for reference only.