
-----------------------------------
ZeppelinManiac
Fri May 25, 2007 8:13 am

Connect 4 Mouse.Where Problems
-----------------------------------
run this program, i can't figure out whats wrong with the mouse input, any help would be awesome. Another thing, if anyone can help with the check, that would be awesome too.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                        CONNECT 4                                            %
%                                     By: Joey Newell                                         %
%                                         ICS 3M1                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TITLE AND INSTRUCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
put "              Connect 4 for Turing"
put "                By: Joey Newell"
put ""
put ""
put ""
put "                                                 2 Player Connect 4!"
put ""
put "                                                 Get 4 of the same colour in a"
put "                                                 row!"
put ""
put "                                                 Remember not to click on a box"
put "                                                 someone has already clicked on!"
put ""
put "                                                 HAVE FUN!"    

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GAMEBOARD %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc GameBoard
    Draw.Box (5, 5, 355, 355, black)
    Draw.Line (75, 5, 75, 355, black)
    Draw.Line (145, 5, 145, 355, black)
    Draw.Line (215, 5, 215, 355, black)
    Draw.Line (285, 5, 285, 355, black)
    Draw.Line (5, 75, 355, 75, black)
    Draw.Line (5, 145, 355, 145, black)
    Draw.Line (5, 215, 355, 215, black)
    Draw.Line (5, 285, 355, 285, black)
end GameBoard

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RED GAME CHIPS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc R11
    Draw.FillOval (40, 40, 30, 30, red)
end R11
proc R21
    Draw.FillOval (110, 40, 30, 30, red)
end R21
proc R31
    Draw.FillOval (180, 40, 30, 30, red)
end R31
proc R41
    Draw.FillOval (250, 40, 30, 30, red)
end R41
proc R51
    Draw.FillOval (320, 40, 30, 30, red)
end R51

proc R12
    Draw.FillOval (40, 110, 30, 30, red)
end R12
proc R22
    Draw.FillOval (110, 110, 30, 30, red)
end R22
proc R32
    Draw.FillOval (180, 110, 30, 30, red)
end R32
proc R42
    Draw.FillOval (250, 110, 30, 30, red)
end R42
proc R52
    Draw.FillOval (320, 110, 30, 30, red)
end R52

proc R13
    Draw.FillOval (40, 180, 30, 30, red)
end R13
proc R23
    Draw.FillOval (110, 180, 30, 30, red)
end R23
proc R33
    Draw.FillOval (180, 180, 30, 30, red)
end R33
proc R43
    Draw.FillOval (250, 180, 30, 30, red)
end R43
proc R53
    Draw.FillOval (320, 180, 30, 30, red)
end R53

proc R14
    Draw.FillOval (40, 250, 30, 30, red)
end R14
proc R24
    Draw.FillOval (110, 250, 30, 30, red)
end R24
proc R34
    Draw.FillOval (180, 250, 30, 30, red)
end R34
proc R44
    Draw.FillOval (250, 250, 30, 30, red)
end R44
proc R54
    Draw.FillOval (320, 250, 30, 30, red)
end R54

proc R15
    Draw.FillOval (40, 320, 30, 30, red)
end R15
proc R25
    Draw.FillOval (110, 320, 30, 30, red)
end R25
proc R35
    Draw.FillOval (180, 320, 30, 30, red)
end R35
proc R45
    Draw.FillOval (250, 320, 30, 30, red)
end R45
proc R55
    Draw.FillOval (320, 320, 30, 30, red)
end R55

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BLACK GAME CHIPS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc B11
    Draw.FillOval (40, 40, 30, 30, black)
end B11
proc B21
    Draw.FillOval (110, 40, 30, 30, black)
end B21
proc B31
    Draw.FillOval (180, 40, 30, 30, black)
end B31
proc B41
    Draw.FillOval (250, 40, 30, 30, black)
end B41
proc B51
    Draw.FillOval (320, 40, 30, 30, black)
end B51

proc B12
    Draw.FillOval (40, 110, 30, 30, black)
end B12
proc B22
    Draw.FillOval (110, 110, 30, 30, black)
end B22
proc B32
    Draw.FillOval (180, 110, 30, 30, black)
end B32
proc B42
    Draw.FillOval (250, 110, 30, 30, black)
end B42
proc B52
    Draw.FillOval (320, 110, 30, 30, black)
end B52

proc B13
    Draw.FillOval (40, 180, 30, 30, black)
end B13
proc B23
    Draw.FillOval (110, 180, 30, 30, black)
end B23
proc B33
    Draw.FillOval (180, 180, 30, 30, black)
end B33
proc B43
    Draw.FillOval (250, 180, 30, 30, black)
end B43
proc B53
    Draw.FillOval (320, 180, 30, 30, black)
end B53

proc B14
    Draw.FillOval (40, 250, 30, 30, black)
end B14
proc B24
    Draw.FillOval (110, 250, 30, 30, black)
end B24
proc B34
    Draw.FillOval (180, 250, 30, 30, black)
end B34
proc B44
    Draw.FillOval (250, 250, 30, 30, black)
end B44
proc B54
    Draw.FillOval (320, 250, 30, 30, black)
end B54

proc B15
    Draw.FillOval (40, 320, 30, 30, black)
end B15
proc B25
    Draw.FillOval (110, 320, 30, 30, black)
end B25
proc B35
    Draw.FillOval (180, 320, 30, 30, black)
end B35
proc B45
    Draw.FillOval (250, 320, 30, 30, black)
end B45
proc B55
    Draw.FillOval (320, 320, 30, 30, black)
end B55

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOUSE INPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc DrawRed
    var x, y, b: int
    loop
        Mouse.Where (x, y, b)
        
        if b=1 and x > 5 and x < 75
            and y > 5 and y < 75 then
            R11
        exit when b=1
        
        elsif b=1 and x > 75 and  x < 145
            and y > 5 and y > 75 then
            R21
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215   
            and y > 5 and y < 75 then
            R31
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 5 and y< 75 then
            R41
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 5 and y < 75 then
            R51
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 75 and y < 145 then
            R12
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 75 and y < 145 then
            R22
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 75 and y < 145 then
            R32
        exit when b=1
        
        elsif b=1 and x > 215 and y < 285
            and y > 75 and y < 145 then
            R42
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 75 and y < 145 then
            R52
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 145 and y < 215 then
            R13
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 145 and y < 215 then
            R23
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 145 and y < 215 then
            R33
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 145 and y < 215 then
            R43
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 145 and y < 215 then
            R53
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 215 and y < 285 then
            R14
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 215 and y < 285 then
            R24
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 215 and y < 285 then
            R34
        exit when b=1 
        
        elsif b=1 and x > 215 and x < 285
            and y > 215 and y < 285 then
            R44
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 215 and y < 285 then
            R54
        exit when b=1
              
        elsif b=1 and x > 5 and x < 75
            and y > 285 and y < 355 then
            R15
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 285 and y < 355 then
            R25
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 285 and y < 355 then
            R35
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 285 and y < 355 then
            R45
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 285 and y < 355 then
            R55
        exit when b=1
        end if
    end loop
end DrawRed

proc DrawBlack
    var x, y, b: int
    loop
        Mouse.Where (x, y, b)
        
        if b=1 and x > 5 and x < 75
            and y > 5 and y < 75 then
            B11
        exit when b=1
        
        elsif b=1 and x > 75 and  x < 145
            and y > 5 and y > 75 then
            B21
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215   
            and y > 5 and y < 75 then
            B31
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 5 and y < 75 then
            B41
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 5 and y < 75 then
            B51
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 75 and y < 145 then
            B12
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 75 and y < 145 then
            B22
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 75 and y < 145 then
            B32
        exit when b=1
        
        elsif b=1 and x > 215 and y < 285
            and y > 75 and y < 145 then
            B42
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 75 and y < 145 then
            B52
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 145 and y < 215 then
            B13
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 145 and y < 215 then
            B23
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 145 and y < 215 then
            B33
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 145 and y < 215 then
            B43
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 145 and y < 215 then
            B53
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 215 and y < 285 then
            B14
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 215 and y < 285 then
            B24
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 215 and y < 285 then
            B34
        exit when b=1 
        
        elsif b=1 and x > 215 and x < 285
            and y > 215 and y < 285 then
            B44
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 215 and y < 285 then
            B54
        exit when b=1
              
        elsif b=1 and x > 5 and x < 75
            and y > 285 and y < 355 then
            B15
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 285 and y < 355 then
            B25
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 285 and y < 355 then
            B35
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 285 and y < 355 then
            B45
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 285 and y < 355 then
            B55
        exit when b=1
        end if
    end loop
end DrawBlack


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHECKS FOR A "CONNECT 4" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PROCEDURE CALLS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GameBoard

loop
    DrawRed
    delay (500)
    DrawBlack
    delay (500)
end loop

-----------------------------------
tenniscrazy
Fri May 25, 2007 10:35 am

RE:Connect 4 Mouse.Where Problems
-----------------------------------
ugh...thats ugly code, i went over the whole thing and i couldn't find anything wrong, it seems like it should work.  its weird what it does tho.  

Why are you cereating all of those procedures tho, u should just draw the circle in the 'mouse input' part where you run the procedure

-----------------------------------
Albrecd
Fri May 25, 2007 12:26 pm

Re: Connect 4 Mouse.Where Problems
-----------------------------------
I've determined why column 2 always puts the circle at the bottom.  In your code to call procedure 21 you have a > sign where you should have a < sign:

elsif b = 1 and x > 75 and x < 145
                and y > 5 and y > 75 then
            R21
            put "P1"
            exit when b = 1

y > 75 in the second line should be y < 75.

I haven't determined the cause of the oddity in the last column, and I don't think I have time right now, but I'll try to figure it out (if anyone beats me to it, go ahead and post your solution).

EDIT: I found the other problem:

elsif b = 1 and x > 215 and y < 285
                and y > 75 and y < 145 then
            B42
            exit when b = 1

the y in the first line should be x instead.

-----------------------------------
ZeppelinManiac
Tue May 29, 2007 8:15 am

Re: Connect 4 Mouse.Where Problems
-----------------------------------
oh another thing, this assignment is due next friday (June 8th I believe), don't mean to rush you guys, just letting you know.
thanks again!
ZeppelinManiac

-----------------------------------
rollerdude
Tue May 29, 2007 12:19 pm

Re: Connect 4 Mouse.Where Problems
-----------------------------------
i agree with tennis crazy, you should come up with a small proc that converts your mouse position, into a grid position, (say that it a 6x7 grid, well then you'd have to use a function like gridpos:=mousepos div (maxx div 7)... or something like that... then you'd use that to determine where to put ur circles when you draw them, it'll save all the time of writeing ur if statements causeing a less chance of a writing error)

hope this helps, good luck and keep programming!

-----------------------------------
Albrecd
Tue May 29, 2007 12:23 pm

Re: Connect 4 Mouse.Where Problems
-----------------------------------
To check for a win, create a variable for each square, and change it's value (ex: 1 for black, 2 for red) when a circle is drawn.  Then after each turn, have the program check for 4 in a row (horizontal, virticle, or on an angle).
If you understand 2D arrays, this would be a capital time to use one, or you may want to check out [url=http://www.compsci.ca/v3/viewtopic.php?t=366]Tony's tutorial on them.

-----------------------------------
Albrecd
Tue May 29, 2007 12:30 pm

Re: Connect 4 Mouse.Where Problems
-----------------------------------
Sorry rollerdude, I guess I was writing while you were posting  :P

-----------------------------------
ZeppelinManiac
Wed May 30, 2007 7:52 am

Re: Connect 4 Mouse.Where Problems
-----------------------------------
hey guys,
yeah i did what tenniscrazy told me to do, the circles now go where i want them, and no i don't know much about 2D arrays, im a grade 10 student in a grade 11 class, so if you could give me an example?
thanks
ZeppelinManiac
heres my new code if you want it:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                        CONNECT 4                                            %
%                                     By: Joey Newell                                         %
%                                         ICS 3M1                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TITLE AND INSTRUCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
put "              Connect 4 for Turing"
put "                By: Joey Newell"
put ""
put ""
put ""
put "                                                 2 Player Connect 4!"
put ""
put "                                                 Get 4 of the same colour in a"
put "                                                 row!"
put ""
put "                                                 Remember not to click on a box"
put "                                                 someone has already clicked on!"
put ""
put "                                                 HAVE FUN!"    

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GAMEBOARD %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc GameBoard
    Draw.Box (5, 5, 355, 355, black)
    Draw.Line (75, 5, 75, 355, black)
    Draw.Line (145, 5, 145, 355, black)
    Draw.Line (215, 5, 215, 355, black)
    Draw.Line (285, 5, 285, 355, black)
    Draw.Line (5, 75, 355, 75, black)
    Draw.Line (5, 145, 355, 145, black)
    Draw.Line (5, 215, 355, 215, black)
    Draw.Line (5, 285, 355, 285, black)
end GameBoard

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOUSE INPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc DrawRed
    var x, y, b: int
    loop
        Mouse.Where (x, y, b)
        
        if b=1 and x > 5 and x < 75
            and y > 5 and y < 75 then
            Draw.FillOval (40, 40, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 75 and  x < 145
            and y > 5 and y < 75 then
            Draw.FillOval (110, 40, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215   
            and y > 5 and y < 75 then
            Draw.FillOval (180, 40, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 5 and y< 75 then
            Draw.FillOval (250, 40, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 5 and y < 75 then
            Draw.FillOval (320, 40, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 75 and y < 145 then
            Draw.FillOval (40, 110, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 75 and y < 145 then
            Draw.FillOval (110, 110, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 75 and y < 145 then
            Draw.FillOval (180, 110, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 75 and y < 145 then
            Draw.FillOval (250, 110, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 75 and y < 145 then
            Draw.FillOval (320, 110, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 145 and y < 215 then
            Draw.FillOval (40, 180, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 145 and y < 215 then
            Draw.FillOval (110, 180, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 145 and y < 215 then
            Draw.FillOval (180, 180, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 145 and y < 215 then
            Draw.FillOval (250, 180, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 145 and y < 215 then
            Draw.FillOval (320, 180, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 215 and y < 285 then
            Draw.FillOval (40, 250, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 215 and y < 285 then
            Draw.FillOval (110, 250, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 215 and y < 285 then
            Draw.FillOval (180, 250, 30, 30, red)
        exit when b=1 
        
        elsif b=1 and x > 215 and x < 285
            and y > 215 and y < 285 then
            Draw.FillOval (250, 250, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 215 and y < 285 then
            Draw.FillOval (320, 250, 30, 30, red)
        exit when b=1
              
        elsif b=1 and x > 5 and x < 75
            and y > 285 and y < 355 then
            Draw.FillOval (40, 320, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 285 and y < 355 then
            Draw.FillOval (110, 320, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 285 and y < 355 then
            Draw.FillOval (180, 320, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 285 and y < 355 then
            Draw.FillOval (250, 320, 30, 30, red)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 285 and y < 355 then
            Draw.FillOval (320, 320, 30, 30, red)
        exit when b=1
        end if
    end loop
end DrawRed

proc DrawBlack
    var x, y, b: int
    loop
        Mouse.Where (x, y, b)
        
        if b=1 and x > 5 and x < 75
            and y > 5 and y < 75 then
            Draw.FillOval (40, 40, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 75 and  x < 145
            and y > 5 and y < 75 then
            Draw.FillOval (110, 40, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215   
            and y > 5 and y < 75 then
            Draw.FillOval (180, 40, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 5 and y< 75 then
            Draw.FillOval (250, 40, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 5 and y < 75 then
            Draw.FillOval (320, 40, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 75 and y < 145 then
            Draw.FillOval (40, 110, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 75 and y < 145 then
            Draw.FillOval (110, 110, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 75 and y < 145 then
            Draw.FillOval (180, 110, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 75 and y < 145 then
            Draw.FillOval (250, 110, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 75 and y < 145 then
            Draw.FillOval (320, 110, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 145 and y < 215 then
            Draw.FillOval (40, 180, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 145 and y < 215 then
            Draw.FillOval (110, 180, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 145 and y < 215 then
            Draw.FillOval (180, 180, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 145 and y < 215 then
            Draw.FillOval (250, 180, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 145 and y < 215 then
            Draw.FillOval (320, 180, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 5 and x < 75
            and y > 215 and y < 285 then
            Draw.FillOval (40, 250, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 215 and y < 285 then
            Draw.FillOval (110, 250, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 215 and y < 285 then
            Draw.FillOval (180, 250, 30, 30, black)
        exit when b=1 
        
        elsif b=1 and x > 215 and x < 285
            and y > 215 and y < 285 then
            Draw.FillOval (250, 250, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 215 and y < 285 then
            Draw.FillOval (320, 250, 30, 30, black)
        exit when b=1
              
        elsif b=1 and x > 5 and x < 75
            and y > 285 and y < 355 then
            Draw.FillOval (40, 320, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 75 and x < 145
            and y > 285 and y < 355 then
            Draw.FillOval (110, 320, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 145 and x < 215
            and y > 285 and y < 355 then
            Draw.FillOval (180, 320, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 215 and x < 285
            and y > 285 and y < 355 then
            Draw.FillOval (250, 320, 30, 30, black)
        exit when b=1
        
        elsif b=1 and x > 285 and x < 355
            and y > 285 and y < 355 then
            Draw.FillOval (320, 320, 30, 30, black)
        exit when b=1
        end if
    end loop
end DrawBlack


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHECKS FOR A "CONNECT 4" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PROCEDURE CALLS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

GameBoard

loop
    DrawRed
    delay (200)
    DrawBlack
    delay (200)
end loop
