Introduction to Programming
Assignment title:
4-in-a-row
Summer 2023
Background information
Complete the following computer programming tasks using Visual Basic. For each task you must test the programming code you create.
The evidence you must produce is a working VB program and a Word document containing the following: • Screenshots of the user interface • Pseudocode • Completed Object Definition Sheet • The Visual Basic program code, with relevant comments (i.e., annotated) • Simple test criteria • Completed Test Log • Screenshots of the output generated when the program code is run
It would be a good idea to use the Windows Snipping tool to assemble this Word document.
You do not have to provide any general commentary on your work in a separate wordprocessed document, but you do have to provide short comments on the code to explain what each function or segment of code does.
You do not have to provide any history of what debugging you may have done. It is very important that the program code is clear, the outputs are designed to be easy to understand and your Word document is well presented.
Introduction
This assessment is worth 100% of your overall grade.
Scenario
The game Connect Four (also known as Four up, Four in a Row, and Connect 4) allows TWO (2) users to each put game pieces in space in a grid. The first user to get 4 of their game pieces in a row horizontally, vertically or diagonally, wins. If you are unfamiliar with the game there are online videos showing how it is played. The grid is 7 x 7 squares:
Each user takes it in turn to enter the column where they want to place their game piece. The piece is then stored in the lowest row where there is not already a piece. For example, player 1 first selects column 1. Their piece (1) is positioned in the bottom row.
Player 2 then also selects column 1. Their piece (2) is positioned 1 row higher.
When a column is full no more pieces can be played in that column.
The game ends when ONE (1) player has 4 pieces in a row, without any spaces or opponent pieces in-between. Or the game ends when every space in the grid has been played.
A user can select to save their game. The current content of the grid is then saved to an external text file, as well as the player whose turn it is to move next. When the program loads, it asks the user if they want to start a new game or load the last saved game.
Hints on design and implementation
- Plan your GUI layout before starting to create the program.
- Think carefully about how the user will select their column, and how the position of the pieces will be shown.
Task – 100 Marks
Task 1 Form design – 10 marks
Design your user interface for TWO (2) VB forms: • A form for the user to either start a new game or load the saved game • A form that allows the user to play the game
Task 2 Pseudocode and Object Definition Sheet – 28 marks
• Write pseudocode for the controls for selecting a new game or loading a saved game • Write pseudocode to allow TWO (2) users to take it in turns to play a piece • Write pseudocode to check whether a user has won by getting 4 pieces in a row horizontally, vertically or diagonally • Write pseudocode to save the game state in a text file • Write pseudocode to load the saved game state when selected • Poduce an Object Definition Sheet for the full program using the template on page8.
Task 3 Implementation – Main program – 32 marks
• Create the form to select a new game or load a saved game
• Create the form to display the grid
• Write the code to load the saved game
• Write the code to load a new game
• Write the code to allow TWO (2) users to play the game
• Write the code to check if a user has won
• Write the code to save the game
Task 4 Testing – 25 marks
• Design a testing strategy and complete a Test Log (see attached template) for each user input and the results. • Ensure you test all possible ways of playing the game and winning the game. • Tests should be documented in the Test Log and using screen shots of tests provided as evidence of testing.
Task 5 Publishing programme and installation documentation 5 marks
• Create documentation to explain how the program can be installed into a new system. Include the necessary information on files and folder location for each file.
• Document common errors that may occur, for example required text files not found, and how they can be corrected.
Guidance
The assessment of your project will depend in part upon the quality of the documentation that you have produced.
- Restate the specification of the assignment by listing the Required Outcomes.
- Take the time required to design the assignment before you type any program code. Follow an appropriate design and documentation sequence.
- Always document your designs before you implement them.
- Keep up-to-date Object Definition Sheets and do basic tests at each stage of the development.
- Provide a detailed design including, where appropriate, the design of any algorithms.
- Build in error handling to involve meaningful messages that would help with any future maintenance of the software.
- Annotate all implementation.
- Design a testing strategy.
- Justify the design of suitable comprehensive test data.
- Show evidence of testing.
- Where appropriate, detail any major corrective action that you have taken in the
light of the testing process.
Submission requirements
A word-processed document must be submitted incorporating the full documentation of all the significant aspects of the development of the assignment above. The document should be submitted both in paper form and digital form.
Refer to the Guidance above when producing your final documentation.
You are required to submit a publishable copy of the compiled system together with installation notes.
This publishable copy, that includes a setup file, should be on an appropriate medium (CD, USB flash drive, etc.).
Candidate checklist Please use the following checklist to ensure that your work is ready for submission. Have you read the NCC Education document Academic Misconduct Policy and ensured that you have acknowledged all the sources that you have used in your work?
❑ Have you completed the Statement and Confirmation of Own Work form and attached it to your assignment? You must do this.
❑ Have you ensured that your work has not gone over or under the recommended word count by more than 10%?
❑ Have you ensured that your work does not contain viruses and can be run directly?