日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

CS 0447代做、代寫c/c++編程設計
CS 0447代做、代寫c/c++編程設計

時間:2024-12-08  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



CS 04** 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 aka 
Four-in-line. The game consists a board representing the play area. Two players face 
each other and drop tokens, one at a time, until one of them manages to place four in 
line! 
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! SOMETHING! 
Game mechanic 
The game works like this: 
1. Initially, the players have a blank board 
2. Player 1 takes the first turn 
Player 1, it's your turn. 
Select a column to play. Must be between 0 and 6 
-1 
That play is invalid. Try again 
Select a column to play. Must be between 0 and 6 

That play is invalid. Try again 
Select a column to play. Must be between 0 and 6 

3. When a valid number is input, a token is placed in that column, at the 
first (lowest) free position. 
4. Next, it’s player 2 turn. 
Player 2, it's your turn. Select a column to play. Must be between 0 and 6 
5. The game ends when one of the players manages to place 4 tokens in 
a horizontal, vertical, or diagonal line. 
Congratulations player 1. You won! 
Congratulations player 2. You won! 
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. 
1. 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. 
2. Think of possible invalid user inputs, and how they will impact the program 
negatively. 
1) Board bounds. 
2) Filling a column to the top. 
Implement 
Implement the MIPS assembly code that executes the game described above. Your 
program will manage all interactions with the user and the board: 
1. It begins by displaying a welcome message and an explanation of what the 
user should do. How is the game played? 
2. Print the empty board. 
3. 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 gives 
no 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 gives 
no 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. 
4. In the end, print a message letting the winning player know the game has 
ended. 
The welcome message 
Bear in mind that you do your own thing, as long as it fits the project! So use the 
welcome 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. You 
must 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 your board as a matrix of words to 
keep the status of the game. Here is one suggestion: 
board: .word 
 0, 0, 0, 0, 0, 0, 0, 
 0, 0, 0, 0, 0, 0, 0, 
 0, 0, 0, 0, 0, 0, 0, 
 0, 0, 0, 0, 0, 0, 0, 
 0, 0, 0, 0, 0, 0, 0, 
 0, 0, 0, 0, 0, 0, 0 
 Note: The board refers only to the contents of the board, not the frame around the 
tiles! The frame is always the same, it doesn’t need to be stored anywhere! If you 
include the frame, it’ll make your life harder! 
For the status of each tile, it is suggested to create a matrix of 0s (empty) 1s (player 
1 tokens), and 2s (player 2 tokens). When you want to print each tile, you simply 
need to check the status matrix to know if the tile was revealed. 
 if(board[i][j] == 0) { print('_') } 
 else if(board[i][j] == 1) { print('*') } 
 else { print('+') } 
Check the example below: 
The board - this is what you draw: 
 0 1 2 3 4 5 6 
The matrix representing the board - contains 1s for player 1, and 2 player 2: 
Board size 
You can do one of two things: Easy route 
The board should be a 7x6 matrix. 
Configurable route 
You can make it configurable if you so wish, and then adjust for difficulty. AT THE 
TOP OF THE FILE! The simplest way is to name a number, like a #define in C. In 
MARS you can do that like this: 
.eqv BOARD_SIZE 42 # 7*6 
.eqv BOARD_WIDTH 7 
.eqv BOARD_HEIGHT 6 
Then you can use the name instead of a number, i.e. in instructions that would 
normally use a number (the code is nonsense, don’t use it): 
lw $t0, 3($t1) -> lw $t0, N_PLAYS($t1) 
li $t0, 3 -> li $t0, N_PLAYS 
beq $t0, 3, _label -> beq $t0, N_PLAYS, _label 
x: .word 3 -> x: .word N_PLAYS 
arr: .word 0:100 -> arr: .word 0:BOARD_ELEMENTS 
Or ask the user 
Create variables, and ask what is the size of the board they want: 
board_size: .word 42 # 7*6 
board_width: .word 7 
board_height: .word 6 
Printing the board 
The board must be shown to the user. Check the example below if you are not sure 
how to proceed. The only requirement here is that Empty tiles must be empty, and 
players should have different tokens to represent the tokens. The following 
examples used an _ to represent empty tiles, * to represent “Player 1” tokens, and + 
to represent “Player 2” tokens. 
Ending the game 
The game should end when one of the players successfully drops 4 tokens in line. At 
that point, let the user know that the game has ended and who won. Example run 
This is only an example. Feel free to ignore everything except functionality. 
Welcome to connect-4 the MIPS version 
 This is a 2 player game, each player will take turns placing 
a token. 
 The objective is to create a line of 4 consecutive tokens. 
 Good luck! 
 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|*|_|_|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|_|*|_|_|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|_|*|*|_|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|_|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|*|_|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|_|+|*|_|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|_|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|_|_| 
|_|_|+|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|_|*|_| 
|_|_|+|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|+|+|*|_| 
|_|_|+|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|_|+|+|*|_| 
|_|_|+|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|+|+|+|*|_| 
|_|_|+|+|*|*|_| 
|_|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|+|+|+|*|_| 
|_|_|+|+|*|*|_| 
|*|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|+|+|+|*|_| 
|+|_|+|+|*|*|_| 
|*|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|+|+|+|*|_| 
|+|*|+|+|*|*|_| 
|*|+|*|*|*|+|_| 
Select a column to play. Must be between 0 and 6 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|+|+|+|+|*|_| 
|+|*|+|+|*|*|_| 
|*|+|*|*|*|+|_| 
Congratulations player 2. You won. 
Thanks for playing! 
 
-- program is finished running -- 
 
Project Stages 
In order to help you be aware of your progress, it is recommended to use a series of 
mile markers to help you divide up the work. You can ignore these if you wish. 
However, if you find you need some direction, by all means follow along. 
Stage 1 - Create the main loop logic and user interaction 
The tedious part of this program will be to create all the strings, display them to the 
user, and get user input. It is also the simpler bit. During the first stage, it is 
suggested you focus on creating an application that prints the strings to the user, 
implements the main loop, and asks the user for input (don’t forget to make sure the 
input column is valid!). At this stage you don’t have to worry about saving the input, 
etc. If you finish early, move on to stage 2 and try to display the board. You can edit 
the matrix manually to “simulate” some plays have occurred. 
Stage 2 - The board 
Now that you display all strings to the user, and get all information from the user, 
you can move on to implement the next step: displaying the board and dropping 
tokens as requested by the user. In this stage, create the data structure that 
represents the board - matrix. Implement functions that help you access the matrix. 
You can start by implementing the code that prints the board to the user, as it will 
help you debug. Then, use the user input to drop a token. When the user chooses a 
column, you may spiral down the column to find the first empty cell. 
If you finish early, move on to stage 3 and try to find winning game conditions 
for horizontal and vertical 4-in-line. 
Stage 3 - Winning the game 
Since you know where the token was dropped, the easiest way, probably not the 
smartest, is to check the matrix entries around the dropped token. For example, this 
was the last dropped token: 
 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
You can check the following 4 regions of interest: 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| 
|_|?|?|?|*|?|?| 
|_|_|_|_|_|_|_| 
|_|_|_|_|_|_|_| |_|_|_|_|_|_|_| 

 0 1 2 3 4 5 6 
|_|_|_|_|?|_|_| 
|_|_|_|_|?|_|_| 
|_|_|_|_|*|_|_| 
|_|_|_|_|?|_|_| 
|_|_|_|_|?|_|_| 
|_|_|_|_|?|_|_| 

 0 1 2 3 4 5 6 
|_|_|?|_|_|_|_| 
|_|_|_|?|_|_|_| 
|_|_|_|_|*|_|_| 
|_|_|_|_|_|?|_| 
|_|_|_|_|_|_|?| 
|_|_|_|_|_|_|_| 

 0 1 2 3 4 5 6 
|_|_|_|_|_|_|?| 
|_|_|_|_|_|?|_| 
|_|_|_|_|*|_|_| 
|_|_|_|?|_|_|_| 
|_|_|?|_|_|_|_| 
|_|?|_|_|_|_|_| Also, don’t forget to stop the game if the board is full. (Just keep track of how 
many tokens were dropped.) 
Helpful Tidbits 
Starting the code 
This is a very simple program in a higher-level language! But it is much more 
complex in assembly. As such, here is some advice for developing your program. 
Plan and start by writing high-level comments on how you plan to approach the 
problem: 
• If you are not sure what to write, start with the items in the “Your 
assignment” section of the project :) 
• Then add detail to those comments. 
• If you need, write the program in a high-level language, draw a diagram, 
write pseudo-code, and then translate that into MISP assembly. 
Testing 
DO NOT TRY TO WRITE THE WHOLE PROGRAM BEFORE TESTING IT! 
• It’s the easiest way to get overwhelmed and confused without knowing what 
to do! 
• Implement small parts of the code and test them! 
Split your code into functions 
Use functions! They will help you manage the cognitive load. Here is a starting point! 
main: 
 jal print_welcome 
 jal display_board 
 
_main_loop: 
 ... 
_main_player1: 
 <stuff> 
 j _main_loop 
 <more stuff> 
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 in 
the comments!) 
• A readme.txt file (DO NOT SUBMIT A README.DOCX/README.PDF. SUBMIT 
A PLAIN TEXT FILE. PLEASE.) which should contain: a) your name, b) your 
student ID, c) anything that does not work, d) anything else you think might 
help the grader grade your project more easily. 
Submit into the Blackboard. Let me know immediately if there are any problems 
submitting your work. 

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp





 

掃一掃在手機打開當前頁
  • 上一篇:代做FIN2020、代寫Java/c++程序語言
  • 下一篇:COMP42215代做、代寫Python設計程序
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 trae 豆包網頁版入口 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    日韩精品一区二区三区高清_久久国产热这里只有精品8_天天做爽夜夜做爽_一本岛在免费一二三区

      <em id="rw4ev"></em>

        <tr id="rw4ev"></tr>

        <nav id="rw4ev"></nav>
        <strike id="rw4ev"><pre id="rw4ev"></pre></strike>
        国产精品入口日韩视频大尺度| 在线 亚洲欧美在线综合一区| 91久久香蕉国产日韩欧美9色| 亚洲国产精品va在看黑人| 久久久久久成人| 免费看的黄色欧美网站| 亚洲电影免费观看高清完整版在线| 国产精品久久久久久五月尺| 亚洲无吗在线| 欧美激情在线观看| 久久五月激情| 国产一区二区久久久| 欧美精品www在线观看| 一区二区三区在线不卡| 欧美色精品天天在线观看视频| 久久亚洲国产精品一区二区| 久久深夜福利免费观看| 欧美亚洲在线播放| 久久国产日韩| 久久久噜噜噜久久久| 欧美日本国产视频| 国产亚洲福利社区一区| 亚洲黄色av一区| 亚洲日本va在线观看| 国产精品国产三级国产普通话蜜臀| 毛片基地黄久久久久久天堂| 欧美片第1页综合| 国产精品手机在线| 巨胸喷奶水www久久久免费动漫| 亚洲三级性片| 久久国产精品久久久久久久久久| 国产一区二区三区四区五区美女| 亚洲国产激情| 欧美精品色一区二区三区| 国户精品久久久久久久久久久不卡| 国产欧美在线观看一区| 国产精品美女久久| 一区二区免费在线观看| 国产精品一区二区黑丝| 午夜精品福利电影| 一区二区三区国产在线| 久久久久久久高潮| 欧美三级视频在线观看| 欧美色另类天堂2015| 亚洲免费久久| 欧美成人精品一区| 亚洲女女做受ⅹxx高潮| 欧美日韩国产大片| 美乳少妇欧美精品| 韩日精品在线| 日韩视频中文字幕| 久久动漫亚洲| 亚洲欧洲日韩女同| 欧美在线电影| 欧美成人高清视频| 欧美激情第一页xxx| 欧美在线视频一区| 国产精品久久看| 欧美日韩精品一区二区天天拍小说| 一本色道久久| 欧美国产日产韩国视频| 欧美精品亚洲精品| 久久精品亚洲精品国产欧美kt∨| 国产亚洲精品一区二555| 国产日韩欧美在线播放不卡| 亚洲素人在线| 欧美日韩一区二区三区四区在线观看| 欧美日韩精品免费观看视频完整| 在线一区二区日韩| 欧美精品18videos性欧美| 欧美激情精品久久久久久黑人| 欧美日韩一区二区三区在线视频| 一区二区电影免费在线观看| 欧美高清影院| 久久成人精品一区二区三区| 欧美日韩中文字幕在线视频| 日韩一级精品视频在线观看| 欧美视频中文字幕在线| 亚洲电影激情视频网站| 黄色亚洲大片免费在线观看| 亚洲一区免费看| 国产色视频一区| 欧美亚日韩国产aⅴ精品中极品| 久久精品一区二区国产| 国产精品久久久久久影院8一贰佰| 国产精品一区免费视频| 久久天天躁夜夜躁狠狠躁2022| 亚洲一区二区三区影院| 亚洲色图综合久久| 日韩一级在线观看| 欧美日韩精品在线视频| 欧美 日韩 国产在线| 狠色狠色综合久久| 亚洲第一综合天堂另类专| 亚洲区在线播放| 亚洲高清二区| 亚洲国产99精品国自产| 久久se精品一区精品二区| 99在线|亚洲一区二区| 国产婷婷色综合av蜜臀av| 亚洲日本欧美| 亚洲黄色一区| 国产精品第一页第二页第三页| 亚洲欧美伊人| 国产一区免费视频| 久久躁日日躁aaaaxxxx| 国产精品久久久久久亚洲毛片| 午夜国产精品视频| 久久精品av麻豆的观看方式| 你懂的网址国产 欧美| 日韩一级免费观看| 国产精品一区二区久久| 久久免费偷拍视频| 久久精品国产欧美激情| 久久久夜夜夜| 国产精品国产三级国产普通话三级| 欧美大尺度在线观看| 国产亚洲一区二区三区在线观看| 国产一区二区日韩精品| 美女主播一区| 亚洲一二三四久久| 欧美日韩中字| 欧美日韩在线亚洲一区蜜芽| 欧美日韩大陆在线| 亚洲精品色婷婷福利天堂| 尤妮丝一区二区裸体视频| 亚洲视频国产视频| 一区二区亚洲精品| 亚洲国产裸拍裸体视频在线观看乱了中文| 国产农村妇女精品| 99精品视频免费在线观看| 亚洲人成在线观看| 欧美久久久久久蜜桃| 国产一区二区中文| 国产精品高清一区二区三区| 亚洲视频电影图片偷拍一区| 午夜精品理论片| 亚洲高清色综合| 欧美成人激情视频免费观看| 国内在线观看一区二区三区| 国产婷婷色一区二区三区四区| 一区二区三区高清在线| 免费观看亚洲视频大全| 国产精品乱码久久久久久| 欧美午夜国产| 国产精品福利片| 亚洲精品麻豆| 欧美影院成年免费版| 久久久久综合| 一区久久精品| 亚洲精品国产精品久久清纯直播| 一区二区三区四区五区在线| 亚洲精品免费网站| 国产日韩欧美一区二区三区四区| 国内成人精品一区| 亚洲男人第一网站| 国产色爱av资源综合区| 亚洲经典在线| 一本色道久久综合亚洲二区三区| 欧美日韩精品免费看| 亚洲宅男天堂在线观看无病毒| 国产精品手机视频| 一区二区在线视频| 国产精品久久77777|