Connect Four Checking...XD
Author |
Message |
KevinW
|
Posted: Thu Mar 01, 2007 9:53 pm Post subject: Connect Four Checking...XD |
|
|
code: | procedure checkHorizontal
for decreasing row : 5 .. 0
for column : 0 .. 3
if grid (row, column) = check and grid (row, column + 1) = check and grid (row, column + 2) = check and grid (row, column + 3) = check then
fourLine := true
end if
end for
end for
end checkHorizontal |
This is my working code for a horizontal win, but i'm wondering why my original checking method never works...I just finished G10 programming last semester.
code: | procedure checkHorizontal
for decreasing row : 5 .. 0
for column : 0 .. 3
if grid (row, column) = check then
fourLine (1) := true
elsif grid (row, column + 1) = check then
fourLine (2) := true
elsif grid (row, column + 2) = check then
fourLine (3) := true
elsif grid (row, column + 3) = check then
fourLine (4) := true
end if
end for
end for
end checkHorizontal |
*Note, the checking system is still very basic, i just need it to work first before i continue on with the winning page and looping game. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|