Chess question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Chess question

Post by cto1mac »

Ok, so I know it is a completely selfish pursuit: building a mysql/php chess game. I have gotten a few different things to work to create the table: for loops and such. But, I cannot help but feel that an array would be the way to create the table and allow me to track movement. So I created an array.

Code: Select all

$arr = array('x','y'....);
So now I have this array that is 63 (starting with 0) long. How do I get a looping structure to continue reading all of the array but start a new output row when it hits the end of the 8 block row?

Thanks for the help.
And anyone who wants to help on this project is more than welcome to contact me. I just think that chess is about the best game on the planet and want to create my own training, gaming site for fun. I also have my mind set to try some other baseline games, othello, checkers, battleship and such.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

if(index+1%8 == 0 )
start new row
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Post by cto1mac »

Thanks for the quick responses. I will look into the sourceforge project.
Post Reply