%Connect 4%
%Large Program%
setscreen ("graphics:vga")
procedure gui
drawfillbox (10, 10, maxx - 10, maxy - 10, 14)
drawbox (10, 10, maxx - 10, maxy - 10, 16)
%draws game outline
drawline (98, 10, 98, maxy - 10, 16)
drawline (186, 10, 186, maxy - 10, 16)
drawline (274, 10, 274, maxy - 10, 16)
drawline (362, 10, 362, maxy - 10, 16)
drawline (450, 10, 450, maxy - 10, 16)
drawline (538, 10, 538, maxy - 10, 16)
%draws the 7 columns required for game
drawfilloval (55, 39, 25, 25, white)
drawfilloval (55, 94, 25, 25, white)
drawfilloval (55, 150, 25, 25, white)
drawfilloval (55, 205, 25, 25, white)
drawfilloval (55, 260, 25, 25, white)
drawfilloval (55, 315, 25, 25, white)
%fills the first column with white circles
drawoval (55, 39, 25, 25, 16)
drawoval (55, 94, 25, 25, 16)
drawoval (55, 150, 25, 25, 16)
drawoval (55, 205, 25, 25, 16)
drawoval (55, 260, 25, 25, 16)
drawoval (55, 315, 25, 25, 16)
%outlines the circles in black in first column
drawfilloval (145, 39, 25, 25, white)
drawfilloval (145, 94, 25, 25, white)
drawfilloval (145, 150, 25, 25, white)
drawfilloval (145, 205, 25, 25, white)
drawfilloval (145, 260, 25, 25, white)
drawfilloval (145, 315, 25, 25, white)
%fills second column with white circles
drawoval (145, 39, 25, 25, 16)
drawoval (145, 94, 25, 25, 16)
drawoval (145, 150, 25, 25, 16)
drawoval (145, 205, 25, 25, 16)
drawoval (145, 260, 25, 25, 16)
drawoval (145, 315, 25, 25, 16)
%outlines the circles in black in second column
drawfilloval (235, 39, 25, 25, white)
drawfilloval (235, 94, 25, 25, white)
drawfilloval (235, 150, 25, 25, white)
drawfilloval (235, 205, 25, 25, white)
drawfilloval (235, 260, 25, 25, white)
drawfilloval (235, 315, 25, 25, white)
%fills the third column with white circles
drawoval (235, 39, 25, 25, 16)
drawoval (235, 94, 25, 25, 16)
drawoval (235, 150, 25, 25, 16)
drawoval (235, 205, 25, 25, 16)
drawoval (235, 260, 25, 25, 16)
drawoval (235, 315, 25, 25, 16)
%outlines the circles in black in third column
drawfilloval (320, 39, 25, 25, white)
drawfilloval (320, 94, 25, 25, white)
drawfilloval (320, 150, 25, 25, white)
drawfilloval (320, 205, 25, 25, white)
drawfilloval (320, 260, 25, 25, white)
drawfilloval (320, 315, 25, 25, white)
%fills the fourth column with white circles
drawoval (320, 39, 25, 25, 16)
drawoval (320, 94, 25, 25, 16)
drawoval (320, 150, 25, 25, 16)
drawoval (320, 205, 25, 25, 16)
drawoval (320, 260, 25, 25, 16)
drawoval (320, 315, 25, 25, 16)
%outlines the circles in black in fourth column
drawfilloval (410, 39, 25, 25, white)
drawfilloval (410, 94, 25, 25, white)
drawfilloval (410, 150, 25, 25, white)
drawfilloval (410, 205, 25, 25, white)
drawfilloval (410, 260, 25, 25, white)
drawfilloval (410, 315, 25, 25, white)
%fills the fifth column with white circles
drawoval (410, 39, 25, 25, 16)
drawoval (410, 94, 25, 25, 16)
drawoval (410, 150, 25, 25, 16)
drawoval (410, 205, 25, 25, 16)
drawoval (410, 260, 25, 25, 16)
drawoval (410, 315, 25, 25, 16)
%outlines the circles in black in fifth column
drawfilloval (500, 39, 25, 25, white)
drawfilloval (500, 94, 25, 25, white)
drawfilloval (500, 150, 25, 25, white)
drawfilloval (500, 205, 25, 25, white)
drawfilloval (500, 260, 25, 25, white)
drawfilloval (500, 315, 25, 25, white)
%fills the sixth column with white circles%
drawoval (500, 39, 25, 25, 16)
drawoval (500, 94, 25, 25, 16)
drawoval (500, 150, 25, 25, 16)
drawoval (500, 205, 25, 25, 16)
drawoval (500, 260, 25, 25, 16)
drawoval (500, 315, 25, 25, 16)
%outlines the circles in black in sixth column%
drawfilloval (590, 39, 25, 25, white)
drawfilloval (590, 94, 25, 25, white)
drawfilloval (590, 150, 25, 25, white)
drawfilloval (590, 205, 25, 25, white)
drawfilloval (590, 260, 25, 25, white)
drawfilloval (590, 315, 25, 25, white)
%fills the seventh column with white circles%
drawoval (590, 39, 25, 25, 16)
drawoval (590, 94, 25, 25, 16)
drawoval (590, 150, 25, 25, 16)
drawoval (590, 205, 25, 25, 16)
drawoval (590, 260, 25, 25, 16)
drawoval (590, 315, 25, 25, 16)
%outlines the circles in black in seventh column%
end gui
var x, y, button : int
var player : int
gui
player := 12
loop
mousewhere (x, y, button)
if button = 1 and 30 <= x and x <= 80 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (55, 39, 25, 25, player)
elsif button = 1 and 30 <= x and x <= 80 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (55, 94, 25, 25, player)
elsif button = 1 and 30 <= x and x <= 80 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (55, 150, 25, 25, player)
elsif button = 1 and 30 <= x and x <= 80 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (55, 205, 25, 25, player)
elsif button = 1 and 30 <= x and x <= 80 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (55, 260, 25, 25, player)
elsif button = 1 and 30 <= x and x <= 80 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (55, 315, 25, 25, player)
%fills the circles in first column with colour; either red or blue%
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (145, 39, 25, 25, player)
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (145, 94, 25, 25, player)
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (145, 150, 25, 25, player)
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (145, 205, 25, 25, player)
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (145, 260, 25, 25, player)
elsif button = 1 and 145 - 25 <= x and x <= 145 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (145, 315, 25, 25, player)
%fills the circles in second column with colour; either red or blue%
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (235, 39, 25, 25, player)
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (235, 94, 25, 25, player)
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (235, 150, 25, 25, player)
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (235, 205, 25, 25, player)
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (235, 260, 25, 25, player)
elsif button = 1 and 235 - 25 <= x and x <= 235 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (235, 315, 25, 25, player)
%fills the circles in third column with colour; either red or blue%
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (320, 39, 25, 25, player)
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (320, 94, 25, 25, player)
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (320, 150, 25, 25, player)
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (320, 205, 25, 25, player)
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (320, 260, 25, 25, player)
elsif button = 1 and 320 - 25 <= x and x <= 320 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (320, 315, 25, 25, player)
%fills the circles in fourth column with colour; either red or blue%
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (410, 39, 25, 25, player)
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (410, 94, 25, 25, player)
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (410, 150, 25, 25, player)
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (410, 205, 25, 25, player)
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (410, 260, 25, 25, player)
elsif button = 1 and 410 - 25 <= x and x <= 410 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (410, 315, 25, 25, player)
%fills the circles in fifth column with colour; either red or blue%
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (500, 39, 25, 25, player)
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (500, 94, 25, 25, player)
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (500, 150, 25, 25, player)
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (500, 205, 25, 25, player)
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (500, 260, 25, 25, player)
elsif button = 1 and 500 - 25 <= x and x <= 500 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (500, 315, 25, 25, player)
%fills sixth colum with colour; either red or blue%
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 39 - 25 <= y and y <= 39 + 25 then
drawfilloval (590, 39, 25, 25, player)
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 94 - 25 <= y and y <= 94 + 25 then
drawfilloval (590, 94, 25, 25, player)
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 150 - 25 <= y and y <= 150 + 25 then
drawfilloval (590, 150, 25, 25, player)
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 205 - 25 <= y and y <= 205 + 25 then
drawfilloval (590, 205, 25, 25, player)
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 260 - 25 <= y and y <= 260 + 25 then
drawfilloval (590, 260, 25, 25, player)
elsif button = 1 and 590 - 25 <= x and x <= 590 + 25 and 315 - 25 <= y and y <= 315 + 25 then
drawfilloval (590, 315, 25, 25, player)
%fills seventh column with colour; either red or blue%
end if
exit when button = 1 and 1000 <= x and x <=900 and 150 <=y and y<= 250
if player = 12 then
player := 16
else
player := 12
end if
end loop
gui |