{Pranay Orugunta
2/25/11
Enloe HS
Lyerly
Contest 3
Jr 5}
Program
ACSLContest3;uses crt;
type
a=array[1..14] of integer;
var board:a;
b,c,d,count,counter,code,temp:integer;
e:string;
begin
clrscr;
for count:=1 to 14 do
begin
board[count]:=4;
end;
board[7]:=0;
board[14]:=0;
for counter:=1 to 5 do
begin
writeln('Please input the numbers
with comma');
readln(e);
b:=pos(',',e);
Val(copy(e,1,b-1), c, Code);
Delete(e,1,b);
val(e,d,code);
if c>=7 then
begin
c:=c+1;
end;
if d>=7 then
begin
d:=d+1;
end;
temp:=board[c];
for count:=1 to board[c] do
begin
if
counter mod 2 =1 then
begin
if
(c+count) mod 14 <>0 then
begin
board[(c+count)mod
14]:=board[(c+count)mod 14]+1;
end;
if
(c+count) mod 14 = 0 then
begin
board[(c+temp)mod
14+1]:=board[(c+temp)mod 14+1]+1;
end;
board[c]:=0;
end;
if counter mod 2 =0 then
begin
if
((c+count) mod 14 <>0) and ((c+count) mod 14 <> 7)then
begin
board[(c+count)mod
14]:=board[(c+count)mod 14]+1;
end;
if (c+count) mod 14 = 7 then
begin
board[(c+temp)mod 14
+1]:=board[(c+temp)mod 14 +1]+1;
end;
if
(c+count) mod 14 = 0 then
begin
board[14]:=board[14]+1;
end;
board[c]:=0;
end;
end;
writeln;
writeln(board[d]);
end;
readln;
end.