Skip links

Java代写|Board Game Lab 2


2 Getting Started

In this lab, we use the latest Eclipse (2021-12 build):

Go to the course eClass page for your section. Under Lab 2, download the file EECS3311 which
contains the starter project for this lab.

• Unzip the file, and you should see a directory named eecs3311-lab2. It’ s a Eclipse project.
• You can import this project into your Eclipse as an General Java project.

• The start project should have the following structure and on default does compile.


This lab’s major learning goal is applying object oriented design in Java and understand the applicable design
patterns. In this lab, you will be:

• Designing basic classes
• Ensuring classes are small and do one thing (Single Responsibility Principle)
• Creating class abstractions (Dependency Inversion)
• Using inheritance, composition, and polymorphism
• Identify design patterns

We will be encoding the Three Musketeers Board game. Feel free to play against an AI to gain some intuition about
this game.


This game is played on a 5×5 square board with this starting position:
• Starting Position:


• TURNS – The Musketeers always go first. Each player makes one move before passing to their opponent.
MUSKETEER – On the Musketeers’ turn, a musketeer can move to an adjacent orthogonal (neighboring,
non-diagonal) cell occupied by a guard, capturing it and occupying that cell.

• GUARD – On the Guards’ turn, a guard can move to an adjacent orthogonal empty cell.


– The Musketeers win if they cannot capture any guards AND if they are not on the same row or column.
– The guards win if all the musketeers are on the same row or column at any point in the game.