CS 0447 Computer Organization and Assembly Language
Midterm Project – Connect 4
Introduction In this project, you will implement a 2 player game in MIPS assembly: Connect 4 akaFour-in-line. The game consists a board representing the play area. Two players faceeach other and drop tokens, one at a time, until one of them manages to place four inline!
Start early The deadline will approach fast! Life happens, sickness happens, so if you start early,you can minimize the impact. Do a little bit every day! 1 hour every day! 30 minutes
every day! SOMETHINGGame mechanic The game works like this:
- Initially, the players have a blank board
Your assignment
Plan
Plan your implementation which includes data structures you are planning to use,user inputs that may be invalid and you need to account for, etc.
- Think of which functions you will need to implement, and what they will do.
- 1) Start from the main function and split your program into multiple steps.
- 2) This plan is not going to be enforced, but it should be thought through.
- Think of possible invalid user inputs, and how they will impact the programnegatively.
- 1) Board bounds.
- 2) Filling a column to the top.
Implement Implement the MIPS assembly code that executes the game described above. Yourprogram will manage all interactions with the user and the board:
It begins by displaying a welcome message and an explanation of what theuser should do. How is the game played?Print the empty board.
- Then, the game begins, and your program will:
- 1) Ask player 1 to play:▪ Ask and validate user input (MARS will crash if the user givesno input or a letter, this is fine!)▪ Don’t allow the user to select a non-existing tile.▪ Don’t allow the user to select a full column.▪ “Drop” the token into the board at the requested column.▪ Check for a winning condition.
- 2) Ask player 2 to play:
▪ Ask and validate user input (MARS will crash if the user givesno input or a letter, this is fine!)▪ Don’t allow the user to select a non-existing tile!
▪ Don’t allow the user to select a full column!▪ “Drop” the token into the board at the requested column.▪ Check for a winning condition.
- 3) Repeat until one of the players wins or the board is full.
- In the end, print a message letting the winning player know the game hasended.
The welcome message
Bear in mind that you do your own thing, as long as it fits the project! So use thewelcome message to explain to the user exactly how it should play the game. Explain
the rules, and how the player can score points.User input Your program needs to ask the user in which column he/she wants to drop a token.If the user inputs an invalid value, you inform the user of that and ask again.You must validate the user input! The exact way you implement this is up to you. Youmust ask the user to input something to select the column.
Representing the board Feel free to implement all data structures that you need. However, it is suggested
you’d better use matrices. You can implement 代寫CS 0447 Computer Organization and Assembly your board as a matrix of words tokeep the status of the game. Here is one suggestion:board: .word
Submission Submit a single ZIP file with your project named studentID_MidtermProj.zip(e.g., 2023141520000_ MidtermProj.zip). In the zip file, there should be NO folder,
just the following files:• Your connect.asm file. (Put your name and student ID at the top of the file inthe comments!)
- A readme.txt file (DO NOT SUBMIT A README.DOCX/README.PDF. SUBMITA PLAIN TEXT FILE. PLEASE.) which should contain: a) your name, b) yourstudent ID, c) anything that does not work, d) anything else you think mighthelp the grader grade your project more easily.Submit into the Blackboard. Let me know immediately if there are any problemssubmitting your work.