Your correct use of functions and compliance with relevant conventions such as the Application Binary Interface will be part of the assessment.
You now have a working matchsticks program, but so far only text-based output. Modify your program so that, upon commencement of the game, the number of matchsticks remaining is represented graphically. That is, you should utilise ARMlite's graphics display to show each matchstick remaining. How you choose to draw a matchstick is up to you (it may be as simple as a line, but we encourage creativity here!), however the number of matches drawn must be correct after each turn and should be easy to interpret by the player. You should also ensure you have sufficient space to show up to 100 matches as per the option. More creative and sophisticated displays may be eligible for modest bonus credit. Save your solution using the filename stage4.asm
Matchsticks The game The game starts with a specified pile of matchsticks. Two players take it in turns to remove either 1 , 2 , or 3 matchsticks from the remaining pile. A player wins the game by forcing the opponent to take the last matchstick. Your full implementation will pit a single player against the computer. Your full implementation will also incorporate some simple graphics output. The Assignment You will be implementing the game Matchsticks as described above, following the prescribed stages below.
Stage 2 - Single Player Input Extending on your implementation from Stage 1, write an ARMlite compatible assembly program that fulfills the following: - Prints to screen: "Player >, there are <X> matchsticks remaining". where < name > is the name of the player, and X is the remaining number of matchsticks. - Prompts the player to enter a number of matchsticks to remove with the output: "Player , how many do you want to remove (1-3)?" - Reads in the integer value entered, and ensures the number entered is valid. The number must be between 1 and 3 , and not be larger than the current number of matchsticks remaining. If these conditions are not met, then your program should repeatedly ask until the number entered is valid. - Updates the number of matchsticks remaining based on the number entered. - Repeats the above until all matchsticks are gone. - Once all matchsticks are gone, prints "Game Over" and terminates. Save your full solution to a file called stage2.asm.
age 1 - Game Setup efore the game can start, some setup information needs to be entered. do all this, write an ARM assembly program that: - asks for the name of the player by prompting the user with: "Please enter your name". Any names entered should be stored in character arrays for future use. - asks for the starting number of matchsticks with the prompt: “How many matchsticks (5-100)?" which can be any number between 5 and 100 . If the number entered is outside of this range, or simply invalid, then the question should be asked again until a valid number is entered. - Once all the above is read in, the program should print the following message, each on separate lines: Player 1 is Matchsticks: ou should replace the above "<...>" parts with the actual data entered. ve your solution using the filename stage1.asm
Stage 3-Implement Human versus Computer You have now implemented a program that allows a player to keep removing matchsticks until none are left. Your task now is to implement a computer player to play against. Specifically, modify your orogram from Stage 2 to ensure it satisfies the following: - Alternates turns between the human player and the computer player. The human player should always go first. - When it is the human player's turn, the same inputs and outputs should be implemented as per Stage 2. - When it is the computer player's turn, the screen output should read: "Computer Player's turn". - The computer player's turn should utilise ARMlite's random number generator in order to select a number between 1 and 3 to remove from the matchsticks count. The number selected should also not exceed the number of matchsticks remaining. See Lab 8 for information on random number generation in ARMlite. - Once a valid random number is obtained, this should be used to update the total number of matchsticks remaining. - Once either player's turn (human or computer) is complete, the total number of matchsticks should be inspected. If it is 1 , then the player who's turn just occurred is the winner (i.e., they have forced the other player to pick up a single remaining matchstick). If the total number of remaining matches is >1, then play continues. If it is 0 , then the game is a draw. Based on the above conditions, one of the following three messages should be displayed as appropriate: "Player , YOU WIN!", "Player , YOU LOSE!", or "It's a draw!" - Upon game completion, your program should ask if the player wants to play again with the output: "Play again (y/n) ?" If the input is " y ", your program should start the game again (with the same settings as before) If the input is " n ", your program should terminate. If the input is anything else, your program should ask again. Save your solution using the filename stage3.asm