Tic Tac Toe Game
.data
currentState: .asciiz "This is the current state of the GameBoard:\n"
playerOne: .asciiz "Player One won\n"
playerTwo: .asciiz "Player Two won\n"
playerNone: .asciiz "No winners found\n"
enterMove: .asciiz "\nEnter a board position (0-8) to make move:\n"
invalidMove: .asciiz "\nInvalid move - try again.\n"
CR: .byte '\n
SPACE: .byte 0x20
O: .byte 'o
X: .byte 'x
DOT .byte '.
player: .byte 0x01
gameBoard: .byte 0,0,0,0,0,0,0,0,0 # fresh clean empty gameboard
.code
.globl main
##########################################################################
# CheckTriplet
# Check the gameboard positions matching the triplet passed in
# to determine either player has won that specific triplet.
#
# Input:
# $a0 : first position to check on gameboard
# $a1 : second position to check on gameboard
# $a2 : third position to check on gameboard
#
# Output:
# $v0 : 0 = no winner found
# $v0 : 1 = player one won
# $v0 : -1 = player two won
# AS WELL AS an appropriate message if player one or player two has won
#
##########################################################################
CheckTriplet:
# COPY YOUR PAST IMPLEMENTATION HERE
##########################################################################
# CheckForWin
# Invoke CheckTriplet against the 8 possible winning combinations
# to determine if anyone has won the game yet
# row 0
# row 1
# row 2
# col 0
# col 1
# col 2
# diagonal 0
# diagonal 1
#
# Output:
# $v0 : 0 = no winner found
# $v0 : 1 = player one won
# $v0 : -1 = player two won
##########################################################################
CheckForWin:
# COPY YOUR PAST IMPLEMENTATION HERE
##########################################################################
# PRINTBOARD
##########################################################################
PrintBoard:
# COPY YOUR PAST IMPLEMENTATION HERE
##########################################################################
# RequestMove
#
# ToDo:
# return $v0 = player's choice to move to that is valid
#
##########################################################################
RequestMove:
# COPY YOUR PAST IMPLEMENTATION HERE
##########################################################################
# CheckForMoreMoves
#
# ToDo:
# return $v0 = 0 if no more moves left on gameBoard
# return $v0 = 1 if yes there are more moves left on gameBoard
#
##########################################################################
CheckForMoreMoves:
# COPY YOUR PAST IMPLEMENTATION HERE
##########################################################################
# TOGGLEPLAYER
##########################################################################
TogglePlayer:
lb $t0,player
sub $t0,$zero,$t0
sb $t0,player
jr $ra # return from function call
##########################################################################
# MAIN
##########################################################################
main:
# Print the board
# request the move
# apply the move to the board & toggle player
# check for win
# check for more moves
# loop until win or draw
# if no winners found, say so and exit
# print the board one last time before exiting
# exit
Sir I have vast experience in assembly language,u can view my profile and complete on time.I am a full time freelancer,
working for more than 2 years now. Have clients from different parts of the world.