关键词 > Python代写

MSc Coursework Software and Systems 2023-2024

发布时间:2023-11-30

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ELECTRONIC, ELECTRICAL AND SYSTEMS ENGINEERING

MSc Coursework Software and Systems

2023-2024

Design and Implementation of Battleships Computer Game

(GUI)

Aims and Objectives

You are required to design and implement an object-oriented software for the game Battleships. For this game each player has two 10 by 10 grids as their playing board.

Figure 1: Battleships Game Grid

Setup

Image courtesy:http://www.papg.com/images/Battleships1.gif

This game will be played as a single player game, the player will play against the computer.

The game rules are given below and can also be foundhere.

1. Game Setup

A board with two sets of 100 squares, arranged ten by ten is used. Each player has a fleet of ships of different sizes as follows:

.    1 x Aircraft carrier - 5 squares

.    1 x Battleship - 4 squares

.    1 x Cruiser - 3 squares

.    2 x Destroyers - 2 squares each

.    2 x Submarines - 1 square each

Each player needs to place their fleet on the left-hand of the two grids according to the following rules (an example setup is shown in Figure 1):

.    Place in any horizontal or vertical position, but not diagonally;

.    Do not place a ship so that any part of it overlaps another ship or extends outside the grid;

.    You cannot move your ships once the game starts.

The objective of the game is to destroy all of the opponent’s ships before they destroy yours.

2. Gameplay

The player to go first can be decided by a coin toss, after which the players take turns to make a shot:

.    the player whose turn it is declares the coordinates of one of the squares e.g. B5;

.    the opponent needs to reply:

o “hit” if the square contains one of their ships;

o “miss” if it does not contain one of their ships;

o “you  sank my  …” (e.g. “you  sank  my  battleship”)  if  it  was  the  last remaining square of one of their ships;

.    The player whose turn it is should mark the shot on their right hand grid:

o x for a hit;

o o for a miss.

.    The opponent should mark the shot on their left hand grid with an x.

An example game board during play is shown in Figure 2.

Figure 2: Battleships Game Play

Image courtesy:http://www.papg.com/images/Battleships2.gif

The game concludes when all of a player’s fleet is destroyed.

Tasks

Using the object-oriented approach, design and implement the game Battleships as a Python application. The application should be able to create a GUI containing all widgets  required  to  run  the  game  smoothly. The  application should  have  the following functionality:

1.  Allow the Player to enter their name.

2. The application alerts the players that the game is starting and asks them to place all ships on the board.

3. The application alerts that it is ‘PlayerName’s’ turn.

4. The player should then complete their turn.

5. The application alerts everyone that it is the computer’s turn.

6. The computer should then take a turn.

7. This is repeated until the game concludes.

8. Displays the winner’s name and asks the user to quit or play another game.

After creating your GUI with all the above widgets, you will then have to bind these to the functions to get your application working. You will need to handle any exceptions that may arise during its use.

Assessment

This is a small group piece of coursework (maximum 3 group members) which contributes 60% of the total mark for the Software and Systems module. You are expected to submit the following:

.    Design Report

.    Python program

The design report and python code (.py file) must be submitted via canvas as two separate files in one go. Click on the + Add Another File link to add another ‘Choose File’ button while submitting your assignment.

1.  Design Report

The report must contain the relevant UML diagrams produced to design this game. The report must fully address all relevant issues. The assignment is open-ended but it is important that all diagrams of the design process are considered to a reasonable level of detail.

The figures, tables and pages should be numbered. Captions should be beneath figures and above tables. The report should not exceed 10 pages.

This assignment involves the development of designs on paper. It should be possible to draw good quality design diagrams using Word or other word processing package, adopting the correct notation. There is no need to use any Object-Oriented Design Tools. This  is  because  the  learning  curve  associated with object-oriented design tools is normally steep. Many design consultants use graphical design programs and not object-oriented design tools to document designs. Two tools that you might find useful are Visio (might require licence) and ArgoUML.

The report must be submitted via canvas as one single pdf file.

The mark distribution will be as follows:

a)   Introduction,   which    includes   the   discussion    and   interpretation   of   the specification,  and  should   identify  any   issues  that   require  clarification.  (3 marks)

b)   Use-Case Diagram, Survey description and CRC cards. (15 marks)

c)   Detailed class diagram with all attributes, methods, their visibilities,

arguments, return types and relationships to define architecture. (6 marks)

d)   Detailed interaction diagrams, both collaboration and sequence diagram. (12 marks)

e)   Detailed state chart diagram to show events, actions and qualifiers. (6 marks) f)   Discussion of non-functional requirements. (3 marks)

g)   Discussion of any constraints limiting you to implement part(s) of your design (5 marks)

2. Python Program:

This  should  be  the  implementation  of  your  design  for  the  game.  The  classes, methods  and  attributes  created  during  the  design   process  should   be   used  in implementation.

The mark distribution will be as follows:

a)   The quality of programming – appropriate design of the code, use of classes, methods, attributes, reusability of code, etc.). (20 marks)

b)  Game Functionality. (15 marks)

c)   GUI design. (10 marks)

d)  Well documented code. (5 marks)