Computer Science Canada Checkerboard program code needed |
Author: | Schaef [ Thu Dec 11, 2003 10:16 pm ] |
Post subject: | Checkerboard program code needed |
I need a code for a checker board that has sqaures that are 50 pixels by 50 pixels and has 8 rows and 8 colums |
Author: | Homer_simpson [ Thu Dec 11, 2003 10:37 pm ] |
Post subject: | |
well basically u are going to need a 2d arrow like this: board_array : array 1..8,1..8 of blah and yer gonna draw yer board like this : for i : 1 .. 8 for j : 1 .. 8 drawbox (i * 50, j * 50 - 1, i * 50 - 50, j * 50 - 50, black) end for end for and make up some rules for yer game and vohlaaaaaa!!! |
Author: | vinkster [ Fri Dec 12, 2003 12:00 am ] | ||
Post subject: | a little code | ||
this might help.........property of a checker
|
Author: | DanShadow [ Fri Dec 12, 2003 4:26 pm ] |
Post subject: | |
Homers way is correct...but when my teacher asked me to make checkers, my board was made out of lines...saves a few lines of codes. |
Author: | Schaef [ Fri Dec 12, 2003 4:58 pm ] |
Post subject: | |
what would go in the place of "blah" for the array? |
Author: | DanShadow [ Fri Dec 12, 2003 5:38 pm ] |
Post subject: | |
board_array : array 1..8,1..8 of int (blah=int) because the x,y val ues of each square is an integer value...well or real if you want it to be. |
Author: | Homer_simpson [ Fri Dec 12, 2003 6:43 pm ] |
Post subject: | |
well that depends on yer game for example if u need to know just if the block is empty or full ,u make it an array of booleans so whenever block(3,1) for example is full it's value is true.... or if u need to know which player's object is in the block... use an array of int so whenever block(5,2) for example has value 0 it's empty whenever 1 player one and when ever 2 player 2's object... |
Author: | McKenzie [ Fri Dec 12, 2003 10:28 pm ] | ||
Post subject: | |||
homer++
|
Author: | drumersrule123 [ Fri Dec 12, 2003 10:35 pm ] |
Post subject: | |
just import a picture of a chess board with Pic.ScreenLoad |
Author: | Andy [ Sat Dec 13, 2003 4:58 pm ] |
Post subject: | |
then pic.scale it to 50 pixels |
Author: | DanShadow [ Sat Dec 13, 2003 5:00 pm ] |
Post subject: | |
Id prefer just using "for" to draw lines or boxes because on some peoples versions of Turing, pictures get REALLY screwy, and dont load, and freeze program, and other things. I know its happened to me b4, and I have Turing 4.04! |
Author: | Schaef [ Tue Dec 16, 2003 4:49 pm ] |
Post subject: | |
McKenzie, could you or someone else plz explain 'how' your code works? |
Author: | Andy [ Tue Dec 16, 2003 8:06 pm ] |
Post subject: | |
lol its not hard... but since my compsci teacher is good at explaining things, i'll let him explain... |
Author: | Schaef [ Wed Dec 17, 2003 8:20 am ] |
Post subject: | |
can someone plz explain it?? |
Author: | DanShadow [ Wed Dec 17, 2003 11:55 am ] |
Post subject: | |
I think Mckenzies code makes (in two for statements), boxes which extend 8 spaces up, 8 spaces right, then draw the dif inside.... |