Starting from:

$24.99

ENCS3340 Project 1 Solution


Purpose: The purpose of this project is to make you develop heuristics and state space search for a game,


In this project, you will implement a 2-player game called Magnetic Cave.

Magnetic Cave is a 2-player adversary game where each player tries to build a “bridge” of 5 magnetic bricks within a cave whose left and right walls are magnetic. For the sake of this project, the bricks of one player will be represented by a ■ and the bricks of the other by a □. The version of Magnetic Cave that you will implement will be played on a regular 8x8 chess board.

The rules of the game are simple:
- Initially, the cave (the board) is empty.
- Player ■ and player □ move in an alternate fashion, starting with ■. So ■ starts, followed by □, then ■ again, then □ again, ...
- Because there are two big magnets on each side of the cave, a player can only place a brick on an empty cell of the cave provided that the brick is stacked directly on the left or right wall, or is stacked to the left or the right of another brick (of any color).
- As soon as one player is able to align 5 consecutive bricks in a row, in a column or in a diagonal, then this player wins the game.
- If no player is able to achieve a winning configuration and the board is full, then the game stops and there is a tie.

The following figures show possible configurations of the game.



Illegal configuration:
Brick B6 cannot be placed there.
Here, player ■ wins.
He built a bridge from D7 to H7.
Here, player □ wins.
He built a bridge from A3 to E7.

Your Task

Play Modes
Your program should be able to run in manual mode and in automatic mode. This means that you should be able to run your program with:
1. manual entry for both ■’s moves and □’s moves
2. manual entry for ■’s moves & automatic moves for □
3. manual entry for □’s moves & automatic moves for ■
After each move, your program must display the new configuration of the board.

Programming details
To program the game, you can use Python, Java, C or C++. If you wish to use another language, please check with me first. It is not necessary to have a fancy user-interface. A simple command-line interface is sufficient

Tournament
To make the project more fun, we will organize a tournament between all the projects submitted. 1 bonus point will be allocated to your result in this tournament. If, at anytime, your program takes more that 3 seconds to decide its next move, you will automatically be eliminated from the game, and your opponent will win.

Report
Your final deliverable must be accompanied by a written report (~3-5pages) that:
- describes your program (how to run it, what the main functions and data structures are, …); - describes and justifies your heuristic.
- describes and explains your results at the tournament (why you think you lost against your opponent – or why you think you won the tournament).

Submission:

میثاق شرف الأمانة الأكادیمیة

بجومب لیجستلا يف اذھ قاسملا یلتزم الطالب باحترام أنظمة وقوانین الجامعة وخاصة تلك المتعلقة بالأمانة العلمیة وعدم الغش. ویتحمل الطالب مسئولیة ذاتیة، أدبیة وقانونیة، عن المحافظة على الأمانة العلمیة وذلك بالامتناع عن الغش في الامتحانات والوظائف والتقاریر، وعدم السماح لغیره من الطلاب بأن ینقلوا عنھ في الامتحانات والوظائف والتقاریر.

یستوجب الغش أو محاولة الغش التوبیخ والإجراءات القانونیة المنصوص علیھا في تعلیمات الأمانة الأكادیمیة التي أقرھا سلجم ةعماجلا ،لمشتو ام يلی:
1. العقوبة الأكادیمیة: یقررھا مدرس المساق وقد تصل إلى علامة رسوب في المساق.
2. العقوبة التأدیبیة: تقررھا لجنة النظام في الكلیة وقد تصل إلى الفصل المؤقت أو النھائي من الجامعة.

بموجب تسجیلي في ھذا المساق واستلامي لھذا المیثاق أتعھد أمام ﷲ أن أحافظ على الأمانة الأكادیمیة بأن أمتنع عن الغش ،وأن لا أتسامح مع أي محاولة للغش من قبِل انیرخلآ.

2. In addition, write one of the following statements on your assignment/project:

3. Hand in each deliverable electronically: o Create one zip file, containing all files for your assignment/project.
o Name your zip file this way:
▪ For individual work: name the zip file: a1_studentID, where studentID is your ID number.
▪ For group work: name the zip file: a1_studentID1_studentID2, where studentID1 and studentID2 are the ID numbers of each student.
o Upload your zip file at: Ritaj as project1.

Have fun!

More products