A
aud
Добрый день, нужна помощь с исходником(скачаным) крестиков ноликов
Код:
<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">тут</div></div><div class="sp-body"><div class="sp-content">
(целый код
Проблема: когда ходит комп. или человек то сразуже вылетает эррор:
link removed
или
link removed
Код:
<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">тут</div></div><div class="sp-body"><div class="sp-content">
Код:
program X_and_O;
uses crt;
var f : array[0..2,0..2] of integer;
game,pcalc,ccalc : word;
wv : integer;
p1,c1,xcur,ycur,sv,sv2,sv3,int,m,snd : byte;
com,p2,c2 : char;
move : boolean;
label start,plr_play,com_play,cp2,newgame,ng2,win,endgame;
begin
int:=1;
snd:=1;
p1:=10;
p2:='X';
c1:=14;
c2:='O';
randomize;
textbackground(2);
goto newgame;
{Na4alo igri}
start:
clrscr;
f[0,0]:=0;
f[0,1]:=0;
f[0,2]:=0;
f[1,0]:=0;
f[1,1]:=0;
f[1,2]:=0;
f[2,0]:=0;
f[2,1]:=0;
f[2,2]:=0;
textbackground(2);
clrscr;
textcolor(1);
gotoxy(3,4);
write('Igrok: 0 Komputer(');
case int of
0 : write('prof');
1 : write('norma');
2 : write('kretin');
end;
write('): 0');
gotoxy(3,5);
write('€Ја : 1');
textbackground(7);
textcolor(8);
gotoxy(1,1);
clreol;
write(#24#25#26#27,' >> dvizenije kursora SPACE >> hod 1 >> novaja igra 2 >> ўл室 ');
textbackground(2);
if move then goto plr_play else goto com_play;
{Hod igroka}
plr_play:
if (game=100) or (game=200) or (game=300) then goto endgame;
textcolor(1);
gotoxy(10,4);
write(pcalc);
gotoxy(24,4);
case int of
0 : write('prof');
1 : write('norma');
2 : write('kretin');
end;
write('): ');
write(ccalc);
gotoxy(9,5);
case game of
0..100 : wv:=100-game;
101..200 : wv:=200-game;
else wv:=300-game;
end;
write(game,'(do konca turinra ostalosj ',wv,' igr)');
gotoxy(35,10);
write('ЪДДДВДДДВДДДї');
gotoxy(35,11);
write('і і і і');
gotoxy(35,12);
write('ГДДДЕДДДЕДДДґ');
gotoxy(35,13);
write('і і і і');
gotoxy(35,14);
write('ГДДДЕДДДЕДДДґ');
gotoxy(35,15);
write('і і і і');
gotoxy(35,16);
write('АДДДБДДДБДДДЩ');
sv:=0;
repeat
sv2:=f[trunc(sv/3),sv mod 3];
if sv2<>0 then
begin
gotoxy(trunc(sv/3)*4+37,(sv mod 3)*2+11);
if sv2=1 then begin textcolor(p1); write(p2); end else begin textcolor(c1); write(c2); end;
end;
sv:=sv+1;
until sv=9;
textcolor(5);
gotoxy(xcur*4+38,ycur*2+11);
write('');
sv:=0;
repeat
wv:=f[sv,0]+f[sv,1]+f[sv,2];
if (wv=3) or (wv=-3) then goto win;
wv:=f[0,sv]+f[1,sv]+f[2,sv];
if (wv=3) or (wv=-3) then goto win;
sv:=sv+1;
until sv=3;
wv:=f[0,0]+f[1,1]+f[2,2];
if (wv=3) or (wv=-3) then goto win;
wv:=f[2,0]+f[1,1]+f[0,2];
if (wv=3) or (wv=-3) then goto win;
if (f[0,0]<>0) and (f[0,1]<>0) and (f[0,2]<>0) and (f[1,0]<>0) and (f[1,1]<>0) and (f[1,2]<>0) and (f[2,0]<>0) and (f[2,1]<>0)
and (f[2,2]<>0) then
begin
sound(snd*1000);
f[0,0]:=0;
f[0,1]:=0;
f[0,2]:=0;
f[1,0]:=0;
f[1,1]:=0;
f[1,2]:=0;
f[2,0]:=0;
f[2,1]:=0;
f[2,2]:=0;
delay(snd*2000);
nosound;
gotoxy(8,8);
textcolor(14);
write('ЌЁзмп. ');
game:=game+1;
if move then move:=false else move:=true;
readkey;
gotoxy(8,8);
write(' ');
if move then goto plr_play else goto com_play;
end;
com:=readkey;
case com of
'1' : goto newgame;
'2' : exit;
' ' : if f[xcur,ycur]=0 then begin f[xcur,ycur]:=1; goto com_play; end
else begin sound(snd*100); delay(snd*300); nosound; end;
#27 : exit;
#0 :
begin
com:=readkey;
case com of
#72 : if ycur>0 then ycur:=ycur-1;
#75 : if xcur>0 then xcur:=xcur-1;
#77 : if xcur<2 then xcur:=xcur+1;
#80 : if ycur<2 then ycur:=ycur+1;
end;
end;
end;
goto plr_play;
{Hod kompjutera}
com_play:
if (game=100) or (game=200) or (game=300) then goto endgame;
sv:=0;
repeat
sv2:=f[trunc(sv/3),sv mod 3];
if sv2<>0 then
begin
gotoxy(trunc(sv/3)*4+37,(sv mod 3)*2+11);
if sv2=1 then begin textcolor(p1); write(p2); end else begin textcolor(c1); write(c2); end;
end;
sv:=sv+1;
until sv=9;
sv:=0;
repeat
wv:=f[sv,0]+f[sv,1]+f[sv,2];
if (wv=3) or (wv=-3) then goto win;
wv:=f[0,sv]+f[1,sv]+f[2,sv];
if (wv=3) or (wv=-3) then goto win;
sv:=sv+1;
until sv=3;
wv:=f[0,0]+f[1,1]+f[2,2];
if (wv=3) or (wv=-3) then goto win;
wv:=f[2,0]+f[1,1]+f[0,2];
if (wv=3) or (wv=-3) then goto win;
if (f[0,0]<>0) and (f[0,1]<>0) and (f[0,2]<>0) and (f[1,0]<>0) and (f[1,1]<>0) and (f[1,2]<>0) and (f[2,0]<>0) and (f[2,1]<>0)
and (f[2,2]<>0) then goto plr_play;
if int=2 then goto cp2;
sv:=random(int+2);
if (sv=2) and (int<>0) then goto cp2;
if (f[1,1]=0) and (random(3)<>2) then begin f[1,1]:=-1; goto plr_play; end;
sv:=0;
repeat
if (f[sv,0]+f[sv,1]+f[sv,2]=2) or (f[sv,0]+f[sv,1]+f[sv,2]=-2) then
begin
sv2:=0;
repeat
if f[sv,sv2]=0 then f[sv,sv2]:=-1;
sv2:=sv2+1;
until sv2=3;
goto plr_play;
end;
if (f[0,sv]+f[1,sv]+f[2,sv]=2) or (f[0,sv]+f[1,sv]+f[2,sv]=-2) then
begin
sv2:=0;
repeat
if f[sv2,sv]=0 then f[sv2,sv]:=-1;
sv2:=sv2+1;
until sv2=3;
goto plr_play;
end;
sv:=sv+1;
until sv=3;
if (f[0,0]+f[1,1]+f[2,2]=2) or (f[0,0]+f[1,1]+f[2,2]=-2) then
begin
if f[0,0]=0 then f[0,0]:=-1;
if f[1,1]=0 then f[1,1]:=-1;
if f[2,2]=0 then f[2,2]:=-1;
goto plr_play;
end;
if (f[2,0]+f[1,1]+f[0,2]=2) or (f[2,0]+f[1,1]+f[0,2]=-2) then
begin
if f[2,0]=0 then f[2,0]:=-1;
if f[1,1]=0 then f[1,1]:=-1;
if f[0,2]=0 then f[0,2]:=-1;
goto plr_play;
end;
cp2:
repeat
sv:=random(10);
if f[trunc(sv/3),sv mod 3]=0 then begin f[trunc(sv/3),sv mod 3]:=-1; goto plr_play; end;
until sv=11;
goto plr_play;
{Nastrojki igri}
newgame:
clrscr;
textcolor(1);
write(' Nastrojki novoi igri');
gotoxy(4,7);
write('1 >> Intelekt komputera: ');
gotoxy(4,8);
write('2 >> Vi budete hotitj ');
gotoxy(4,11);
write('5 >> Pervij Hod');
gotoxy(4,12);
write('6 >> Zvuk');
gotoxy(4,16);
textcolor(1);
write('SPACE >> na4atj igru esc >> vihod');
ng2:
textcolor(14);
gotoxy(31,7);
case int of
0 : write('profeccional');
1 : write('normalnij ');
2 : write('kretin ');
end;
gotoxy(26,8);
if p2='X' then write('krestikom') else write('nolikom ');
gotoxy(20,11);
case m of
0 : write('slu4ajno ');
1 : write('vash ');
2 : write('komputera ');
end;
gotoxy(14,12);
if snd=1 then write('vklu4en ') else write('vikly4en');
gotoxy(4,9);
textcolor(p1);
write('3 >> Cvet vasej viski');
gotoxy(4,10);
textcolor(c1);
write('4 >> Cvet viski kompjutera');
com:=readkey;
case com of
'1' : if int>0 then dec(int) else int:=2;
'2' : if p2='X' then begin p2:='O'; c2:='X'; end else begin p2:='X'; c2:='O'; end;
'3' : begin if p1<15 then p1:=p1+1 else p1:=0; if p1=2 then p1:=3; end;
'4' : begin if c1<15 then c1:=c1+1 else c1:=0; if c1=2 then c1:=3; end;
'5' : if m<2 then m:=m+1 else m:=0;
'6' : if snd=1 then snd:=0 else snd:=1;
#27 : exit;
' ' :
begin
sv:=random(2);
case m of
0 : if sv<1 then move:=true else move:=false;
1 : move:=true;
2 : move:=false;
end;
game:=1;
pcalc:=0;
ccalc:=0;
goto start;
end;
end;
goto ng2;
{Pobeda}
win:
gotoxy(8,8);
clreol;
if wv=3 then begin pcalc:=pcalc+1; textcolor(4); write('Vi vijgrali!'); end
else begin textcolor(8); write('Vi proigrali.'); ccalc:=ccalc+1; end;
game:=game+1;
f[0,0]:=0;
f[0,1]:=0;
f[0,2]:=0;
f[1,0]:=0;
f[1,1]:=0;
f[1,2]:=0;
f[2,0]:=0;
f[2,1]:=0;
f[2,2]:=0;
sound(snd*500);
delay(snd*2000);
nosound;
delay(snd*1000);
sound(snd*500);
delay(snd*2000);
nosound;
readkey;
gotoxy(1,8);
clreol;
if move then move:=false else move:=true;
if move then goto plr_play else goto com_play;
{Okon4anije tornura}
endgame:
delay(6400);
while keypressed do readkey;
clrscr;
textcolor(7);
gotoxy(35,3);
if game<300 then write('’гаЁа ®Є®зҐ.') else write('€Ја ®Є®зҐ .');
textcolor(5);
if pcalc>ccalc then begin gotoxy(15,6); write('‚л ўлЁЈа «Ё г Є®¬ЇмовҐа б® бзс⮬ ',pcalc,':',ccalc,' Џ®§¤а ў«по!'); end;
if pcalc=ccalc then begin gotoxy(36,6); write('ЌЁзмп. ',pcalc,':',ccalc); end;
if pcalc<ccalc then begin gotoxy(15,6); write('‘®¦ «Ґо, ўл Їа®ЁЈа «Ё Є®¬ЇмовҐаг б® бзс⮬ ',pcalc,':',ccalc); end;
window(5,10,80,25);
textcolor(14);
write('”а®ўҐм ЁвҐ««ҐЄв Є®¬ЇмовҐа : ');
case int of
0 : writeln('Їа®дҐббЁ® «.');
1 : writeln('®а¬ «мл© ЁЈа®Є.');
2 : writeln('ЄаҐвЁ.');
end;
writeln;
writeln(' ЋжҐЄ ў иЁе бЇ®б®Ў®б⥩:');
writeln('ўлЁЈал襩: ',round(pcalc/game*100),'%');
writeln('Їа®ЁЈал襩: ',round(ccalc/game*100),'%');
writeln('ЁЈа Ёзмо: ',100-round(pcalc/game*100)-round(ccalc/game*100),'%');
writeln;
writeln('‚ЇҐз в«ҐЁп Є®¬ЇмовҐа ® ў б Ё ®Ў ЁЈаҐ б ў ¬Ё:');
textcolor(4);
wv:=round(pcalc/game*100);
case int of
1 : dec(wv,-5);
2 : dec(wv,-10);
end;
case wv of
-10..-6 : write('"Ќг Ё в®а¬®§!"');
-5..0 : write('"‚®®ЎйҐ Ґ 㬥Ґв ЁЈа вм."');
1..10 : write('"ЌҐг¦Ґ«Ё Єв®-в® ЁЈа Ґв Ґйс е㦥?"');
11..20 : write('"’ҐЎҐ 㦮 е®а®иҐмЄ® Ї®в२஢ вмбп!"');
21..30 : write('"”ЁЈ®ў® ЁЈа Ґим."');
31..40 : write('"ЊпЈЄ® Ј®ў®ап, Ґ ®зҐм."');
41..50 : write('"ЌҐЇ«®е®, ҐЇ«®е®, ® ¬®¦® ¬®Ј® «гзиҐ."');
51..60 : write('"ЌҐЇ«®е®© १г«мв в. •®вп, Є®Ґз®, ¬®¦® Ё Ї®«гзиҐ...');
61..70 : write('"•®а®и® ЁЈа Ґим!"');
71..80 : write('"Љ«сў® ЁЈа Ґим! ” ⥡п бЄ®«мЄ® ¬ҐЈ Ў ©в®ў Ї ¬пвЁ?"');
81..90 : write('"•®а®иЁ© १г«мв в! ќе, ¬Ґ Ўл в Є..."');
91..97 : write('"Ћв«Ёз п ЁЈа !!!"');
98..100 : begin textcolor(6); write('"’л зв®, бгЇҐаЄ®¬ЇмовҐа?!"'); end;
end;
writeln;
writeln;
writeln;
textcolor(1);
if game<300 then write('Џа®ЎҐ« >> Їа®¤®«¦Ёвм ЁЈаг esc >> ўл室') else write('Ќ ¦¬ЁвҐ «оЎго Є« ўЁиг ¤«п ўл室 .');
window(1,1,80,25);
if game<300 then
repeat
com:=readkey;
case com of
' ' : begin inc(game); if move then move:=false else move:=true; goto start; end;
#27 : exit;
end;
until com=#27
else
begin
readkey;
exit;
end;
window(1,1,80,25);
goto start;
end.
(целый код
Ссылка скрыта от гостей
)Проблема: когда ходит комп. или человек то сразуже вылетает эррор:
или