Presentation is loading. Please wait.

Presentation is loading. Please wait.

Peg Solitaire with Depth First Search

Similar presentations


Presentation on theme: "Peg Solitaire with Depth First Search"— Presentation transcript:

1 Peg Solitaire with Depth First Search
By: Iris Garcia

2 Peg Solitaire Single-player board game with pegs that can come in many different shapes such as: Cross Square Pyramid Triangle The purpose of the game is to eliminate all pegs by jumping over them, similar to the game of Checkers.

3 Peg Board The simplest peg solitaire design is the triangular peg board, often referred to as the “Cracker Barrel” design. This design is similar to an equilateral triangle where each edge has the same number of pegs, and each row has one more peg than the row above it. The Board can be represented as a tree in order to implement how to traverse it.

4 Depth First Search Algorithm
DepthFirstSearch(Board b, Peg start) { If (Grandchild.isEmpty()) Jump(); updateBoard(); //updates empty peg, location, etc. else backtrack(); // backtrack to previous and/or try right child }

5 Class Diagram

6 Sequence Diagram

7 Use Case Diagram

8 References Darby, Gary. "Peg Solitaire Game." DelphiForFun Home. 31 Mar < This source offers background information on several different techniques in solving Peg Solitaire. It also includes different representations of Peg Solitaire other than the "Cracker Barrel" design. It also implies that the Depth First Search as one of the most effective solutions. Matos, Armando B. "Depth-first search solves Peg Solitaire." Computer and Information Science Papers CiteSeer Publications ResearchIndex. 31 Mar < This article by Armando B. Matos goes into detail about using the Depth-First Search to solve the Peg Solitaire problem. Matos uses a tree to represent the pegs instead of a graph and gives computation type for implementing this algorithm with different representations of Peg Solitaire. Muhammad, Rashid B. "Depth First Search (DFS)." Depth First Search (DFS). Kent State University. 31 Mar < This source explains the uses of depth-first search and details its algorithm. Neller, Todd. "Uninformed Search." Gettysburg College Computer Science. Gettysburg College. 31 Mar < This source describes Peg Solitaire in a triangular hex grid, and gives a documented example of the source code. O'Brien, Daniel M. "Peg Board Puzzle Solution Page." Daniel M. O'Brien - bootstrap page. 31 Mar < This source gives a more detail analysis of solutions for the "Cracker Barrel" or triangulated representation of Peg Solitaire.


Download ppt "Peg Solitaire with Depth First Search"

Similar presentations


Ads by Google