witam! wiem ze to moze niezbyt pomyslowy kod ale juz taki napisalem, to jest kodzik odpowiadajacy za gre komputera w kolko i krzyzyk :) niechcialem od nikogo sciagac kodu wiec napisalem sam ale cos mi niezbyt chodzi, komputer nie zawsze wykonuje swoj ruch. prosze o pomoc!
procedure TForm1.Timer2Timer(Sender: TObject);
var
x:integer;
begin
x:=random(8);
if Player2.Down then
if x=0 then if not (b1.caption='X') then b1.caption:='O';
if x=0 then if (b1.caption='O') or (b1.caption='X') then
player1.down:=true else if not (b1.caption='X') then b1.caption:='O';
if Player2.Down then
if x=1 then if not (b2.caption='X') then b2.caption:='O';
if x=1 then if (b2.caption='O') or (b2.caption='X') then
player1.down:=true else if not (b2.caption='X') then b2.caption:='O';
if Player2.Down then
if x=2 then if not (b3.caption='X') then b3.caption:='O';
if x=2 then if (b3.caption='O') or (b3.caption='X') then
player1.down:=true else if not (b3.caption='X') then b3.caption:='O';
if Player2.Down then
if x=3 then if not (b4.caption='X') then b4.caption:='O';
if x=3 then if (b4.caption='O') or (b4.caption='X') then
player1.down:=true else if not (b4.caption='X') then b4.caption:='O';
if Player2.Down then
if x=4 then if not (b5.caption='X') then b5.caption:='O';
if x=4 then if (b5.caption='O') or (b5.caption='X') then
player1.down:=true else if not (b5.caption='X') then b5.caption:='O';
if Player2.Down then
if x=5 then if not (b6.caption='X') then b6.caption:='O';
if x=5 then if (b6.caption='O') or (b6.caption='X') then
player1.down:=true else if not (b6.caption='X') then b6.caption:='O';
if Player2.Down then
if x=6 then if not (b7.caption='X') then b7.caption:='O';
if x=6 then if (b7.caption='O') or (b7.caption='X') then
player1.down:=true else if not (b7.caption='X') then b7.caption:='O';
if Player2.Down then
if x=7 then if not (b8.caption='X') then b8.caption:='O';
if x=7 then if (b8.caption='O') or (b8.caption='X') then
player1.down:=true else if not (b8.caption='X') then b8.caption:='O';
if Player2.Down then
if x=8 then if not (b9.caption='X') then b9.caption:='O';
if x=8 then if (b9.caption='O') or (b9.caption='X') then
player1.down:=true else if not (b9.caption='X') then b9.caption:='O';
Check;
timer2.enabled:=false;
end;
z gory dzieki za wszelkie proby pomocy!