Introduction

This programming assignment is to apply the programming principles covered in tutorials and lectures to develop a game using the Python language and Python GUI Programming module namely Tkinter. The development of simple board games using python will be covered over weeks 6 to 8. The aim of the exercise is to enhance a students experience of programming by applying programming principles to a larger problem of developing a complete application. Games were chosen as they offer a direct correlation between the program data and what is seen on the screen. So in order for the game to be played, there must be variables to store the game data such as gradients, images, scores, directions, etc. If any such variables are incorrect or missing, then a feature of the game will not work correctly if at all. As a result, it is apparent when the program data and/or processing are in error.

Objective

What you have to do is write a game in Python using text based interface or/and Python Tkinter module where you have to choose one from the following list of board games as the one you are going to write:

  • Battleship
  • Connect4
  • Master Mind
  • Minesweeper

Each game has a number of feature requirements that you must meet in order to achieve a specific mark for those features as well as the main criteria listed in the coursework specification here. The specific features refine the criteria to clearly define what the game must have or do. Please refer to the marking guidelines for the design and development of each board game.

Scope exists for more advanced students who wish creatively to develop a game with similar behaviours to any of these 4 choices, meeting all marking criteria described in relation to game sprite and related interactions resulting from similar objects and graphic representations. Where any such changes are non-obvious and non-trivial these should be discussed with your lab tutor for your tutorial group first in order to obtain agreement and so we know what to expect when marking your submitted work.

Test documentation is required for the submitted game with test strategy and tables and screen dumps showing a working game. The test documentation should contain 10 to 15 test cases and maybe more as appropriate for enhanced game functionality for higher marks.

1 Battleship:

The game is played on four grids, two for each player, however, only one grid for each player is sufficient when designing a computer game. The grids are typically square usually 1010. Before play begins, each player secretly arranges their ships on their primary grid. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., only one ship can occupy any given square in the grid). The types and numbers of ships allowed are the same for each player. The following table shows a typical number and type of ships:

No. Type of ship Size
1 Aircraft carrier 5
1 Battleship 4
1 Cruiser 3
1 Destroyer 2
1 Submarine 1

During the game, the player cannot see the opponents ships or their location. After the ships have been positioned, the game proceeds in a series of rounds.

In each round, each player takes a turn to announce a target square in the opponent's grid which is to be shot at. If it is a "miss", the grid is marked with a while colour; if it is a "hit" the grid is marked by red. The attacking player can see the hit or miss on the opponents grid with the appropriate colour grid (e.g. red for "hit", white for "miss"), in order to build up a picture of the opponent's fleet, but, players can see everything on their own grid.

When all of the squares of a ship have been hit, the ship is sunk, and the game should announces the losing player and type of ship that was sank. If all of a player's ships have been sunk, the game is over and their opponent wins.

For a better idea about the game, rules and how the game is played read https://en.wikipedia.org/wiki/Battleship_(game) . Also, the game can be played at http://www.battleshiponline.org/.

2 Connect4:

Connect Four is a two-player connection game in which the players first choose a colour and then take turns dropping coloured discs from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to connect four of one's own discs of the same colour next to each other vertically, horizontally, or diagonally before your opponent.

For a better idea about the game, rules and how the game is played read https://en.wikipedia.org/wiki/Connect_Four . Also, the game can be played at http://www.connectfour.org. Accessed on 04 Aug. 16

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.