Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Chessboard
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jessica359




PostPosted: Mon Apr 21, 2008 8:03 am   Post subject: Chessboard

Ok so here we have to output a chessboard using arrays and that if the user give box 1,3 for example it has to output the colour of the box (black or white)
how would I write my array?
thnxs Exclamation Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Tallguy




PostPosted: Mon Apr 21, 2008 9:53 am   Post subject: RE:Chessboard

r u doinfg a chess game 4 ur final?
[Gandalf]




PostPosted: Mon Apr 21, 2008 12:38 pm   Post subject: Re: Chessboard

You could have an 8x8 two dimensional array where the value of each element represents the colour of the corresponding square. A simple way to set the colour in the checkerboard pattern is to use mod on the array index (ie. if the index is odd the colour is white, otherwise it's black). Once you've done that all you need is simple user input and conditional statements.
Jessica359




PostPosted: Mon Apr 21, 2008 1:10 pm   Post subject: RE:Chessboard

awesome thanks
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: