1 1806ICT/1305ENG Major Assignment – Semester 2, 2021 This assignment must be done individually. The submission date is as specified in the Course Profile and L@G site and the submission method will...

Part 1 in the assignment, the grade that is worth 20%


1 1806ICT/1305ENG Major Assignment – Semester 2, 2021 This assignment must be done individually. The submission date is as specified in the Course Profile and L@G site and the submission method will be via electronic submission on L@G and presentation. Note that for each milestone, students will be required to present their submission in-person or via a Microsoft Teams meeting. This assignment involves developing a simple, text-based, mathematical computer game that you will submit in two milestones. The first milestone is game generation, user interface and basic functionality, while the second milestone adds more features to the game. The idea of the game is to add numbers to the empty squares such that you arrive at the figures given in the bottom row and the right-most column of the table by following the arithmetic operators in the order they are given (that is left to right and top to bottom, NO precedence rules apply). The player must use only numbers in the range specified below the table to complete the blank squares. For example, the solution to the puzzle shown below is (from top to bottom, left to right): 4, 1, 3, 7, 4, 7, 3, 6, 2. + x 15 + x + - x 21 x + x x + 20 33 10 20 Use numbers in the range 1 – 9 Part 1. (Worth 20% of Final Grade) Due: Friday week 8, 5pm. Presentation during your scheduled lab session in week 8. Implement the game with a text-based interface and the arithmetic operators + (add), - (subtract), x (multiply), and / (integer divide). Your implementation must include: 1. User can generate a new game of dimension n by n where n is entered by the user (in the example above n = 6) and also specify the number range allowed (1-max, the above example has max=9). The arithmetic operators must vary from game to game (randomly chosen). The "correct" numbers should also be randomly generated, and the totals calculated. 2 2. When generating a new game the user can ask for some valid numbers to be displayed. The game will then randomly select these to show to the user to help them get started on the solution. 3. The user "plays" the game by entering (or removing) numbers from the grid. You can decide exactly how this is done, for example they may enter the grid coordinates first (3,3 for example) then the number to be entered. A "special" number could be used to remove the current value from that square (0 perhaps). All entered moves should be checked to ensure they are valid before modifying the game board. 4. The game board should be re-displayed after each move, and the game continues until the user has won (or quits). 5. Users will get a score that will depend on the time taken, the size of the game and the difficulty of the game and the number of times the user removed a number from their solution. The exact calculation of the score is up to you to determine, so make sure you explain how it is generated in your documentation. 6. User scores will be displayed as the game progresses. HINTS: • Decide on how your program will store the game data first. You will need some type of array to store the current game state and the solution, as well as the score, size of the board, etc. Think about how each number and operator will be represented in the grid. • At a minimum, you will need functions to perform the following tasks: o Generate the game board for a specified size – add random numbers and operators to fill it. o Display the game board to the screen. Consider adding row numbers and columns to aid the user in playing. o Calculate the 'total' of a row or column based on the numbers and operators in that column. o Check if the current solution is correct. o Read a 'move' from the user and check that it is valid. • Develop a design for your solution first – think about how the game will operate, how the functions will fit together, and so on. • Implement the functions one at a time and slowly build the game up. You can create "stub" versions of functions to begin with, then expand on them later. For example, your function to generate a new game could begin by always making exactly the same hard-coded game at first. You could use this game to test the other functions (drawing the board, playing, etc) and once they are working, then come back and write a proper "random" game generator. • contains the srand() and rand() functions that can generate random numbers for you. Read the documentation for these functions and use them. • ASK FOR HELP! This project will no doubt seem very difficult at first, but with some advice from your demonstrator you should be able to get started and make good progress. 3 Part 2. (Worth 30% of Final Grade) Due: Friday week 12, 5pm. Presentation during your scheduled lab session in week 12. Using the program you wrote for Part 1, generate a version of the game specifically for computer programmers by adding at least 6 of the following features for full marks (fewer features will receive fewer marks): 1. User must logon with a username and password to play. 2. User can save their current game and reload it later to continue playing. 3. Add a main menu to allow users to start a new game, load an existing game, or view high scores (high scores must also be saved to file). After completing a game, your program should return to the main menu. 4. Add the arithmetic operator % (modulus). 5. Add the binary operators & (bitwise and), | (bitwise or), ! (bitwise not) and ^ (bitwise exclusive or). 6. Perform the operators in accordance with the C precedence. 7. Add the feature that different number systems can be used (e.g. binary, octal, hex). 8. As an option, entry of a number that would make the solution so far entered invalid is flagged immediately. 9. User can ask for help by having a valid next number automatically inserted into the table. Note there may be more than one valid solution to a partially completed game. 10. Any other feature you think would be interesting. Make sure to check with the teaching staff, and fully explain the feature in your documentation. Notes: 1. You must actually write all C code submitted. 2. You must produce a Word documents describing your code and the testing you have performed. A template document with a rough outline will be provided, however it is expected that you will heavily modify this to suit your work. Marking This assignment is worth 50% of your Final Grade. Both Part 1 and Part 2 of the assignment will be marked out of 100 and marks will be allocated as follows: 1. Documentation of software and testing: 25 marks 2. Quality of C code (e.g. indentation, appropriate naming conventions, program structure, etc): 25 marks 3. Implementation of Game including testing: 50 marks Please note that all submitted assignments will be analysed by a plagiarism detector that is specifically designed for assignment submissions containing C source code.
Sep 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here