0% found this document useful (0 votes)
4 views2 pages

Assignment-2 (1)

The assignment requires students to implement a peg solitaire game using recursion and backtracking algorithms in Java, with a due date of February 14, 2025. Students must follow specific rules regarding the game's mechanics and adhere to submission guidelines, including providing well-commented source files. The marking scheme emphasizes originality and correctness of the program, with penalties for lack of comments or unauthorized assistance.

Uploaded by

isaacmwambua200
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Assignment-2 (1)

The assignment requires students to implement a peg solitaire game using recursion and backtracking algorithms in Java, with a due date of February 14, 2025. Students must follow specific rules regarding the game's mechanics and adhere to submission guidelines, including providing well-commented source files. The marking scheme emphasizes originality and correctness of the program, with penalties for lack of comments or unauthorized assistance.

Uploaded by

isaacmwambua200
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COSC200700125W: Data Structures II

Assignment-2
Due-date: Friday, February 14, 2025 @11:59pm
Cut-off date: Sunday, February 16, 2025 @11:59pm

Objective:
The objective of this assignment is to implement and solve peg solitaire by using recursion and
backtracking algorithms.

Problem Specification:
The following game is actually a puzzle where the board has the form of a cross. It consists of 32
fields. 31 of these fields contain a peg. The single field in the middle of the board is empty. We
mark a peg with ‘X’ and an empty field with ‘O’ in the following examples. The rules of this game

Table 1: Initial position of the pegs Table 2: Final position of the pegs

X X X O O O
X X X O O O
X X X X X X X O O O O O O O
X X X O X X X O O O X O O O
X X X X X X X O O O O O O O
X X X O O O
X X X O O O

are simple:
ˆ you can take a peg and jump over another neighboring peg

ˆ the peg you jumped over is removed from the board

ˆ you solved the puzzle if at the end only on peg exists and is located in the middle of the board

At the start there are only a few possible moves, but the choices are increasing during the game.
Implement a recursive backtracking algorithm in Java, that finds a solution to this puzzle. Your
program must display the board after the movement of every peg. Displaying only the
final board will not receive any credit. You may find it useful: How to Solve Peg Solitaire by
Robert Darke

Please download the PegSolitaireSample before start. You must use all the given
classes. You are not allowed to add/remove any classes. You are also not allowed to
COSC200700125W: Assignment-2

combine multiple class files into one file. You must use all the given methods without
changing their signatures. However, you may add new methods using the given ones
if necessary. Please note that you will not get any credit if your implementations do
not meet the criteria mentioned above.

Submission Instructions:
Please submit only your complete Java source files (.java). Do not submit compressed files,
entire projects, or any other types of files. Comment your program carefully so that it can
be read and understood. If your program is not properly commented, you may lose marks. See
marking scheme for details.

Submit your complete Java source files (.java). Comment your program carefully so that it can
be read and understood. If your program is not properly commented you may lose marks. See
marking scheme for details.

Marking Scheme:
Please note that the submitted work will be considered as your own work and you con-
firm that you have not received any unauthorized assistance including Large Language
Models (LLMs) in preparing for or doing this lab/assignment/examination. You con-
firm knowing that a mark of 0 may be assigned for entire work.

Please download the PegSolitaireSample before start. You must use all the given
classes. You are not allowed to add/remove any classes. You are also not allowed to
combine multiple class files into one file. You must use all the given methods without
changing their signatures. However, you may add new methods using the given ones
if necessary. Please note that you will not get any credit if your implementations do
not meet the criteria mentioned above.

Comments in the program: 5


Complete program, no compile/logical error, and correct output: 45

©25W Dr. Zamilur Rahman

You might also like