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

Username:   Password: 
 RegisterRegister   
 Connect Four Checking...XD
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
KevinW




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: