SlideShare a Scribd company logo
1 of 6
((Note: Assembly Language programming Please and format
from book *86 PROCESSORS. such as
INCLUDE Irvine32.inc ))
Problem: Write a program that simulates the game of Tic-Tac-
Toe. The User will play against the computer (your assembly
program) or the computer will play against itself.
1. You must use a two-dimensional array and Base-Index
operands (Row-major order) throughout the game. The game
board is created with characters.
- | - | -
- | - | -
- | - | -
This is an example of the empty board.
- | x | -
- | o | -
- | - | -
This is an example of a game in progress.
2. All Procedures will be called with PROTO/INVOKE/PROC. I
will be checking for this. DO NOT USE USES as discussed in
class. The only exception is the Irvine32 library. These must be
called with CALL.
3. If the game is player vs computer, start the game by
randomly choosing which of player or computer to make first
move. The first player will be assigned the letter x.
a. The computer chooses a move by selecting an open position
randomly. (We are not developing Artificial Intelligence)
i) However, if the game is player vs computer, and the center
square is available on the computer’s first turn, the computer
MUST chose that square (regardless of whether or not the
computer the first or second player).
ii) Afterwards, all moves by the computer will be random.
b. The player will enter a move via the keyboard.
i) You must check to see if it is a valid move, i.e. not an already
occupied ‘square’, or a square that is non-existent.
ii) Keep asking for a move until a valid move is entered.
c. After each move clear the screen and redisplay the game with
the new move entered.
d. At the conclusion of each game of tic-tac-toe, ask if the
player wishes to play again. Yes, even if it is computer vs
computer.
e. Have a menu option that allows the user to check statistics.
i) How many games played
ii) How many games won by Player 1
iii) How many games won by Player 2
iv) How many games resulted in a draw.
f. When the user chooses to exit the above statistics should be
displayed until a key is pressed.
4. If the game is computer vs computer after each move display
the current state of the game for 2 seconds, before allowing
another move to be made. The user just watch the game being
played.
5. When the game ends, display who won or if the game was a
draw. a. If someone (either player or computer) wins, highlight
the winning path (either three x’s or three o’s) with black on
yellow as the final display.
6. The game will start with a menu. The options are player vs
computer, computer vs computer, and exit.
7. As always, variables used by a procedure must either be
passed to that procedure or created within the procedure. Only
Main PROC can directly access the variables initialized in .data.
All others must be local to the procedures.
8. Style counts to include proper commenting.
Solution
Many computer games, such as strategy games, simulation
games etc uses game boards that can be implemented as two
dimensional arrays. In Java (and in many other languages) 2D
arrays can be defined as an array of 1D arrays. For example a
2D matrix of characters (with dimensions 8x10) can be defined
as follows.
char[][] Board = new char[8][10]
We can think of Board as a table with 8 rows (indexed from
0..7) and 10 columns(indexed from 0..9)
Tic Tac Toe is played on a 3x3 board with two players
alternating between X’s and O’s, alternatively placing their
respective marks on the board. First player succeeding in
getting three of his marks in a row, column or diagonally wins
the game.
How do we design the classes to implement a tictactoe game?
Let us think of the objects in a tictactoe game environment. We
can think of four types of objects, tictactoe board, human
player, dumb (or random) player and smart player. In this
program we will only implement human player and dumb
player. As an extra credit assignment you are encouraged to
write a smart player that can analyze the board and make the
best move. However that is not necessary. Let us begin with the
following classes and methods.
Class
Methods
TicTacToe
clearBoard( ) isWin(int), winner(), printBoard( ), putMark(int,
int)
Driver
Main( )
HumanPlayer
makeMove( TicTacToe B)
ComputerPlayer (extra credit only)
makeMove(TicTacToe B), findMove(TicTacToe B)
DumbPlayer
makeMove(TicTacToe B)
The description of each method can be found in the source code.
Your assignment is to complete the incomplete methods from
TicTacToe, HumanPlayer and DumbPlayer classes.
Testing your program
You may use any kind of IDE such as eclipse to test your
program. However, you need to make sure all programs run
under Andrew linux. You should also check your program by
creating different scenarios.
Human vs Human
First define, two human players and play them against each
other. You can do this by initializing two HumanPlayers as
follows.
HumanPlayer Player1 = new HumanPlayer( );
HumanPlayer Player2 = new HumanPlayer( );
The program should prompt each player to enter position as a
pair of “valid” integers.
For example, two players taking turns can be shown as follows:
> Player X : 0 1
> Player O : 1 1
Game should continue until one player wins or game is a draw.
The program should correctly display the end of the game.
For Example:
Human vs Dumb
Initialize a human player and a dumb player as follows.
HumanPlayer Player1 = new HumanPlayer( );
DumbPlayer Player2 = new DumbPlayer( );
DumbPlayer will always make a random move. Therefore,
human player should be able to usually beat the dumb player.
Dumb vs Dumb
First define, two dumb players and play them against each
other. You can do this by initializing two DumbPlayers as
follows.
DumbPlayer Player1 = new DumbPlayer( );
DumbPlayer Player2 = new DumbPlayer( );
Class
Methods
TicTacToe
clearBoard( ) isWin(int), winner(), printBoard( ), putMark(int,
int)
Driver
Main( )
HumanPlayer
makeMove( TicTacToe B)
ComputerPlayer (extra credit only)
makeMove(TicTacToe B), findMove(TicTacToe B)
DumbPlayer
makeMove(TicTacToe B)

More Related Content

Similar to ((Note Assembly Language programming Please and format from book 8.docx

#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docxadkinspaige22
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number TutorialOXUS 20
 
Game Development Session - 3 | Introduction to Unity
Game Development Session - 3 | Introduction to  UnityGame Development Session - 3 | Introduction to  Unity
Game Development Session - 3 | Introduction to UnityKoderunners
 
This is an individual project, to be completed on your own. It i.docx
This is an individual project, to be completed on your own. It i.docxThis is an individual project, to be completed on your own. It i.docx
This is an individual project, to be completed on your own. It i.docxabhi353063
 
Tic tac toe c++ programing
Tic tac toe c++ programingTic tac toe c++ programing
Tic tac toe c++ programingKrishna Agarwal
 
Tic Tac Toe Java Development
Tic Tac Toe Java DevelopmentTic Tac Toe Java Development
Tic Tac Toe Java Developmentpengqia chen
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA GameSohil Gupta
 
AI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax AlgorithmAI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax AlgorithmKiran Shahi
 
The Ring programming language version 1.4 book - Part 14 of 30
The Ring programming language version 1.4 book - Part 14 of 30The Ring programming language version 1.4 book - Part 14 of 30
The Ring programming language version 1.4 book - Part 14 of 30Mahmoud Samir Fayed
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfmanjan6
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfFashionColZone
 
Agent tic tac-toe - an interactive game for computational thinking
Agent tic tac-toe - an interactive game for computational thinkingAgent tic tac-toe - an interactive game for computational thinking
Agent tic tac-toe - an interactive game for computational thinkingLorennRuster
 

Similar to ((Note Assembly Language programming Please and format from book 8.docx (15)

Ddn
DdnDdn
Ddn
 
#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx#include iostream#include fstream#include Opening.h.docx
#include iostream#include fstream#include Opening.h.docx
 
Week3.pptx
Week3.pptxWeek3.pptx
Week3.pptx
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
 
Game Development Session - 3 | Introduction to Unity
Game Development Session - 3 | Introduction to  UnityGame Development Session - 3 | Introduction to  Unity
Game Development Session - 3 | Introduction to Unity
 
This is an individual project, to be completed on your own. It i.docx
This is an individual project, to be completed on your own. It i.docxThis is an individual project, to be completed on your own. It i.docx
This is an individual project, to be completed on your own. It i.docx
 
Tic tac toe c++ programing
Tic tac toe c++ programingTic tac toe c++ programing
Tic tac toe c++ programing
 
Tic Tac Toe Java Development
Tic Tac Toe Java DevelopmentTic Tac Toe Java Development
Tic Tac Toe Java Development
 
Bow&arrow game
Bow&arrow gameBow&arrow game
Bow&arrow game
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
 
AI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax AlgorithmAI based Tic Tac Toe game using Minimax Algorithm
AI based Tic Tac Toe game using Minimax Algorithm
 
The Ring programming language version 1.4 book - Part 14 of 30
The Ring programming language version 1.4 book - Part 14 of 30The Ring programming language version 1.4 book - Part 14 of 30
The Ring programming language version 1.4 book - Part 14 of 30
 
Please help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdfPlease help with this. program must be written in C# .. All of the g.pdf
Please help with this. program must be written in C# .. All of the g.pdf
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
 
Agent tic tac-toe - an interactive game for computational thinking
Agent tic tac-toe - an interactive game for computational thinkingAgent tic tac-toe - an interactive game for computational thinking
Agent tic tac-toe - an interactive game for computational thinking
 

More from ajoy21

Please complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxajoy21
 
Please cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxPlease cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxajoy21
 
Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxajoy21
 
Please check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxajoy21
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxajoy21
 
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxPlease attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxajoy21
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxajoy21
 
Please answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxPlease answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxajoy21
 
Please answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxPlease answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxajoy21
 
Please answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxPlease answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxajoy21
 
Please answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxPlease answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxajoy21
 
Please answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxPlease answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxajoy21
 
Please answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxPlease answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxajoy21
 
Please answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxPlease answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxajoy21
 
Please answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxPlease answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxajoy21
 
Please answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxPlease answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxajoy21
 
Please answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxPlease answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxajoy21
 
Please answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxPlease answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxajoy21
 
Please answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxPlease answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxajoy21
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxajoy21
 

More from ajoy21 (20)

Please complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docx
 
Please cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxPlease cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docx
 
Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docx
 
Please check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docx
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docx
 
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxPlease attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docx
 
Please answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxPlease answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docx
 
Please answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxPlease answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docx
 
Please answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxPlease answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docx
 
Please answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxPlease answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docx
 
Please answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxPlease answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docx
 
Please answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxPlease answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docx
 
Please answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxPlease answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docx
 
Please answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxPlease answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docx
 
Please answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxPlease answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docx
 
Please answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxPlease answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docx
 
Please answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxPlease answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docx
 
Please answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxPlease answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docx
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docx
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

((Note Assembly Language programming Please and format from book 8.docx

  • 1. ((Note: Assembly Language programming Please and format from book *86 PROCESSORS. such as INCLUDE Irvine32.inc )) Problem: Write a program that simulates the game of Tic-Tac- Toe. The User will play against the computer (your assembly program) or the computer will play against itself. 1. You must use a two-dimensional array and Base-Index operands (Row-major order) throughout the game. The game board is created with characters. - | - | - - | - | - - | - | - This is an example of the empty board. - | x | - - | o | - - | - | - This is an example of a game in progress. 2. All Procedures will be called with PROTO/INVOKE/PROC. I will be checking for this. DO NOT USE USES as discussed in class. The only exception is the Irvine32 library. These must be called with CALL. 3. If the game is player vs computer, start the game by randomly choosing which of player or computer to make first move. The first player will be assigned the letter x. a. The computer chooses a move by selecting an open position randomly. (We are not developing Artificial Intelligence) i) However, if the game is player vs computer, and the center square is available on the computer’s first turn, the computer MUST chose that square (regardless of whether or not the computer the first or second player). ii) Afterwards, all moves by the computer will be random. b. The player will enter a move via the keyboard. i) You must check to see if it is a valid move, i.e. not an already occupied ‘square’, or a square that is non-existent. ii) Keep asking for a move until a valid move is entered.
  • 2. c. After each move clear the screen and redisplay the game with the new move entered. d. At the conclusion of each game of tic-tac-toe, ask if the player wishes to play again. Yes, even if it is computer vs computer. e. Have a menu option that allows the user to check statistics. i) How many games played ii) How many games won by Player 1 iii) How many games won by Player 2 iv) How many games resulted in a draw. f. When the user chooses to exit the above statistics should be displayed until a key is pressed. 4. If the game is computer vs computer after each move display the current state of the game for 2 seconds, before allowing another move to be made. The user just watch the game being played. 5. When the game ends, display who won or if the game was a draw. a. If someone (either player or computer) wins, highlight the winning path (either three x’s or three o’s) with black on yellow as the final display. 6. The game will start with a menu. The options are player vs computer, computer vs computer, and exit. 7. As always, variables used by a procedure must either be passed to that procedure or created within the procedure. Only Main PROC can directly access the variables initialized in .data. All others must be local to the procedures. 8. Style counts to include proper commenting. Solution Many computer games, such as strategy games, simulation
  • 3. games etc uses game boards that can be implemented as two dimensional arrays. In Java (and in many other languages) 2D arrays can be defined as an array of 1D arrays. For example a 2D matrix of characters (with dimensions 8x10) can be defined as follows. char[][] Board = new char[8][10] We can think of Board as a table with 8 rows (indexed from 0..7) and 10 columns(indexed from 0..9) Tic Tac Toe is played on a 3x3 board with two players alternating between X’s and O’s, alternatively placing their respective marks on the board. First player succeeding in getting three of his marks in a row, column or diagonally wins the game. How do we design the classes to implement a tictactoe game? Let us think of the objects in a tictactoe game environment. We can think of four types of objects, tictactoe board, human player, dumb (or random) player and smart player. In this program we will only implement human player and dumb player. As an extra credit assignment you are encouraged to write a smart player that can analyze the board and make the best move. However that is not necessary. Let us begin with the following classes and methods. Class Methods TicTacToe
  • 4. clearBoard( ) isWin(int), winner(), printBoard( ), putMark(int, int) Driver Main( ) HumanPlayer makeMove( TicTacToe B) ComputerPlayer (extra credit only) makeMove(TicTacToe B), findMove(TicTacToe B) DumbPlayer makeMove(TicTacToe B) The description of each method can be found in the source code. Your assignment is to complete the incomplete methods from TicTacToe, HumanPlayer and DumbPlayer classes. Testing your program You may use any kind of IDE such as eclipse to test your program. However, you need to make sure all programs run under Andrew linux. You should also check your program by creating different scenarios. Human vs Human First define, two human players and play them against each other. You can do this by initializing two HumanPlayers as follows. HumanPlayer Player1 = new HumanPlayer( ); HumanPlayer Player2 = new HumanPlayer( ); The program should prompt each player to enter position as a
  • 5. pair of “valid” integers. For example, two players taking turns can be shown as follows: > Player X : 0 1 > Player O : 1 1 Game should continue until one player wins or game is a draw. The program should correctly display the end of the game. For Example: Human vs Dumb Initialize a human player and a dumb player as follows. HumanPlayer Player1 = new HumanPlayer( ); DumbPlayer Player2 = new DumbPlayer( ); DumbPlayer will always make a random move. Therefore, human player should be able to usually beat the dumb player. Dumb vs Dumb First define, two dumb players and play them against each other. You can do this by initializing two DumbPlayers as follows. DumbPlayer Player1 = new DumbPlayer( ); DumbPlayer Player2 = new DumbPlayer( ); Class Methods TicTacToe clearBoard( ) isWin(int), winner(), printBoard( ), putMark(int, int) Driver
  • 6. Main( ) HumanPlayer makeMove( TicTacToe B) ComputerPlayer (extra credit only) makeMove(TicTacToe B), findMove(TicTacToe B) DumbPlayer makeMove(TicTacToe B)