A86: Re: I wish I new how...
[Prev][Next][Index][Thread]
A86: Re: I wish I new how...
i htink i know a way...
i don't know if it will work or not, because i am a beginner asm programmer.
I think, what you can do, is that you keep the board in a 9 variables, or a
matrix(if asm has that, i don't know), and then when the user places a piece
on the board, depending on where he/she placed it, you would assign a 1 or a
5 (5 because if you did two, you would run into problems.) to right var, or
place in the matrix. then, in order to check, just add up the values of the
row/diagonal you want to check. if the value is 3, player 1 one. if the
value is 15, player 2 one. for the vars, ( each board var holds the status
of where a piece is on the board. if it is 1, player 1 as piece, if 5,
player 2. for example, if the board is like this:
X | | row one vars are: brdx1y1, brdx2y1, brdx3y1
---------
|X| row two vars are: brdx1y2, brdx2y2, brdx3y2
---------
| | X row three vars are: brdx1y1, brdx2y1, brdx3y1
just add up what is in brdx1y1, brdx2y2, brdx3y3. and there you have it!
in asm, i think it would be something like this: ( you would call this)
checkdiag1:
ld a,0
ld a,(brdx1y1)
ld b,(brdx2y2)
add a,b
ld b,(brdx3y3)
add a,b
ld (result),a
ld a,(result)
cp 3
jp z,player1won
cp 5
jp z,player2won
ret
or something like that...
i programmed this in visual basic, and if you use 2 for player 2, then if
you check a row in which there is an X and an O, it will say that player 1
won.
hope this helps
akshay
oh yeah, there might be mistakes, as i am only a beginnner.
----- Original Message -----
From: <bubbaloo13@juno.com>
To: <assembly-86@lists.ticalc.org>
Sent: Friday, October 30, 1998 7:05 PM
Subject: A86: I wish I new how...
>
>I wish I knew how to program shells. And can someone help me program and
>ending to tictactoe. It doesn't tell you who won. Please help me.
>
>___________________________________________________________________
>You don't need to buy Internet access to use free Internet e-mail.
>Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
>or call Juno at (800) 654-JUNO [654-5866]
>
>