setscreen ("graphics:532;532;nobuttonbar,nocursor")
var x, y, b : int
var turn : int := 1
var king : array 1 .. 32 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
var spot : array 1 .. 32 of int := init (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
var move : array 1 .. 32 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
var movej : array 1 .. 32 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
var spotred : array 1 .. 32 of int := init (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
var spotblack : array 1 .. 32 of int := init (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
%Draws the Checks
Draw.FillBox (4, 4, 68, 68, red)
Draw.FillBox (4, 136, 68, 200, red)
Draw.FillBox (4, 268, 68, 332, red)
Draw.FillBox (4, 400, 68, 465, red)
Draw.FillBox (68, 68, 136, 136, red)
Draw.FillBox (68, 200, 136, 268, red)
Draw.FillBox (68, 332, 136, 400, red)
Draw.FillBox (68, 465, 136, 528, red)
Draw.FillBox (136, 4, 200, 68, red)
Draw.FillBox (136, 136, 200, 200, red)
Draw.FillBox (136, 268, 200, 332, red)
Draw.FillBox (136, 400, 200, 465, red)
Draw.FillBox (200, 68, 268, 136, red)
Draw.FillBox (200, 200, 268, 268, red)
Draw.FillBox (200, 332, 268, 400, red)
Draw.FillBox (200, 465, 268, 528, red)
Draw.FillBox (268, 4, 332, 68, red)
Draw.FillBox (268, 136, 332, 200, red)
Draw.FillBox (268, 268, 332, 332, red)
Draw.FillBox (268, 400, 332, 465, red)
Draw.FillBox (332, 68, 400, 136, red)
Draw.FillBox (332, 200, 400, 268, red)
Draw.FillBox (332, 332, 400, 400, red)
Draw.FillBox (332, 465, 400, 528, red)
Draw.FillBox (400, 4, 465, 68, red)
Draw.FillBox (400, 136, 465, 200, red)
Draw.FillBox (400, 268, 465, 332, red)
Draw.FillBox (400, 400, 465, 465, red)
Draw.FillBox (465, 68, 528, 136, red)
Draw.FillBox (465, 200, 528, 268, red)
Draw.FillBox (465, 332, 528, 400, red)
Draw.FillBox (465, 465, 528, 528, red)
% Draws the black border
Draw.Box (1, 1, maxx - 1, maxy - 1, black)
Draw.Box (2, 2, maxx - 2, maxy - 2, black)
Draw.Box (3, 3, maxx - 3, maxy - 3, black)
Draw.Box (0, 0, maxx, maxy, black)
% Draws the Pieces and tags the spots they are in
Draw.FillOval (35, 35, 30, 30, brightred)
Draw.FillOval (169, 35, 30, 30, brightred)
Draw.FillOval (300, 35, 30, 30, brightred)
Draw.FillOval (433, 35, 30, 30, brightred)
Draw.FillOval (103, 103, 30, 30, brightred)
Draw.FillOval (235, 103, 30, 30, brightred)
Draw.FillOval (366, 103, 30, 30, brightred)
Draw.FillOval (498, 103, 30, 30, brightred)
Draw.FillOval (35, 168, 30, 30, brightred)
Draw.FillOval (169, 168, 30, 30, brightred)
Draw.FillOval (300, 168, 30, 30, brightred)
Draw.FillOval (433, 168, 30, 30, brightred)
Draw.FillOval (103, 366, 30, 30, black)
Draw.FillOval (235, 366, 30, 30, black)
Draw.FillOval (366, 366, 30, 30, black)
Draw.FillOval (498, 366, 30, 30, black)
Draw.FillOval (35, 433, 30, 30, black)
Draw.FillOval (169, 433, 30, 30, black)
Draw.FillOval (300, 433, 30, 30, black)
Draw.FillOval (433, 433, 30, 30, black)
Draw.FillOval (103, 498, 30, 30, black)
Draw.FillOval (235, 498, 30, 30, black)
Draw.FillOval (366, 498, 30, 30, black)
Draw.FillOval (498, 498, 30, 30, black)
% Alows the pieces to be moved
loop
Mouse.Where (x, y, b)
if b = 1 and x < 68 and y < 200 and x > 4 and y > 4 and turn = 1 and spot (9) = 1 then
Draw.FillOval (35, 168, 30, 30, yellow)
if spot (13) = 0 then
Draw.Oval (103, 235, 30, 30, yellow)
move (13) := 1
end if
if spot (13) = 1 and spotblack (13) = 1 then
Draw.Oval (169, 300, 30, 30, yellow)
movej (13) := 1
end if
end if
if b = 1 and x < 136 and y < 268 and x > 68 and y > 200 and turn = 1 and spot (13) = 0 and move (13) = 1 then
Draw.FillOval (35, 168, 30, 30, red)
Draw.FillOval (103, 235, 30, 30, brightred)
move (13) := 0
spot (9) := 0
spot (13) := 1
end if
if x > 136 and y > 268 and x < 200 and y < 322 and b = 1 and movej (13) = 1 then
Draw.FillOval (35, 168, 30, 30, red)
Draw.FillOval (103, 235, 30, 30, red)
Draw.FillOval (169, 300, 30, 30, brightred)
movej (13) := 0
spot (13) := 0
spot (9) := 0
spotblack (13) := 0
spot (18) := 1
end if
if b = 1 and x < 465 and y < 200 and x > 400 and y > 136 and turn = 1 and spot (12) = 1 then
Draw.FillOval (433, 168, 30, 30, yellow)
if spot (16) = 0 then
Draw.Oval (498, 235, 30, 30, yellow)
move (16) := 1
end if
if spot (15) = 0 then
Draw.Oval (366, 235, 30, 30, yellow)
move (15) := 1
end if
end if
if x > 332 and y > 200 and x < 400 and y < 268 and b = 1 and move (15) = 1 then
Draw.FillOval (433, 168, 30, 30, red)
Draw.FillOval (366, 235, 30, 30, brightred)
Draw.Oval (498, 235, 30, 30, red)
spot (15) := 1
spot (12) := 0
move (15) := 0
move (16) := 0
end if
if x > 465 and y > 200 and x < 528 and y < 268 and b = 1 and move (16) = 1 then
Draw.Oval (366, 235, 30, 30, red)
Draw.FillOval (433, 168, 30, 30, red)
Draw.FillOval (498, 235, 30, 30, brightred)
spot (16) := 1
spot (12) := 0
move (16) := 0
move (15) := 0
end if
end loop
|