主题:急啊.!!!!!!!!pascal 問題
[color=800080][/color][size=5][/size]
请问
1. 怎样在开始游戏的时候叫别人输入明字来代替 player 1 和 player 2??
2. 怎样加入音乐??
3. 问人要不要再玩一次??
请帮我加进去!!!!!!!!!!!
program tictac3;
uses crt;
var
a,b,c,d,e,f,g,h,i,input,symbol:char;
j,player:integer;
begin
clrscr;
a:='A';
b:='B';
c:='C';
d:='D';
e:='E';
f:='F';
g:='G';
h:='H';
i:='I';
writeln('| | | |');
writeln('| ',a,' | ',b,' | ',c,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',d,' | ',e,' | ',f,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',g,' | ',h,' | ',i,' |');
writeln;
for j:=1 to 9 do
begin
if (j mod 2=1)
then begin
symbol:='X';
player:= 1;
end;
if (j mod 2=0)
then begin
symbol:='O';
player:= 2;
end;
write('Player', player,' please input the position:');
readln(input);
if (a='A') and (input ='A')or(input ='a') then a:=symbol
else if (b='B') and (input ='B')or(input ='b') then b:=symbol
else if (c='C') and (input ='C')or(input ='c') then c:=symbol
else if (d='D') and (input ='D')or(input ='d') then d:=symbol
else if (e='E') and (input ='E')or(input ='e') then e:=symbol
else if (f='F') and (input ='F')or(input ='f') then f:=symbol
else if (g='G') and (input ='G')or(input ='g') then g:=symbol
else if (h='H') and (input ='H')or(input ='h') then h:=symbol
else if (i='I') and (input ='I')or(input ='i') then i:=symbol;
writeln('| | | |');
writeln('| ',a,' | ',b,' | ',c,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',d,' | ',e,' | ',f,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',g,' | ',h,' | ',i,' |');
writeln;
if (a=b) and (b=c)
then writeln('Player',player,' WIN !!:)');
if (d=e) and (e=f)
then writeln('Player',player,' WIN !!:)');
if (g=h) and (h=i)
then writeln('Player',player,' WIN !!:)');
if (a=d) and (d=g)
then writeln('Player',player,' WIN !!:)');
if (b=e) and (e=f)
then writeln('Player',player,' WIN !!:)');
if(g=h) and (h=i)
then writeln('Player',player,' WIN !!:)');
if (a=e) and (e=i)
then writeln('Player',player,' WIN !!:)');
if (c=e) and (e=g)
then writeln('Player',player,' WIN !!:)');
end;
end.
请问
1. 怎样在开始游戏的时候叫别人输入明字来代替 player 1 和 player 2??
2. 怎样加入音乐??
3. 问人要不要再玩一次??
请帮我加进去!!!!!!!!!!!
program tictac3;
uses crt;
var
a,b,c,d,e,f,g,h,i,input,symbol:char;
j,player:integer;
begin
clrscr;
a:='A';
b:='B';
c:='C';
d:='D';
e:='E';
f:='F';
g:='G';
h:='H';
i:='I';
writeln('| | | |');
writeln('| ',a,' | ',b,' | ',c,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',d,' | ',e,' | ',f,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',g,' | ',h,' | ',i,' |');
writeln;
for j:=1 to 9 do
begin
if (j mod 2=1)
then begin
symbol:='X';
player:= 1;
end;
if (j mod 2=0)
then begin
symbol:='O';
player:= 2;
end;
write('Player', player,' please input the position:');
readln(input);
if (a='A') and (input ='A')or(input ='a') then a:=symbol
else if (b='B') and (input ='B')or(input ='b') then b:=symbol
else if (c='C') and (input ='C')or(input ='c') then c:=symbol
else if (d='D') and (input ='D')or(input ='d') then d:=symbol
else if (e='E') and (input ='E')or(input ='e') then e:=symbol
else if (f='F') and (input ='F')or(input ='f') then f:=symbol
else if (g='G') and (input ='G')or(input ='g') then g:=symbol
else if (h='H') and (input ='H')or(input ='h') then h:=symbol
else if (i='I') and (input ='I')or(input ='i') then i:=symbol;
writeln('| | | |');
writeln('| ',a,' | ',b,' | ',c,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',d,' | ',e,' | ',f,' |');
writeln('|___|___|___|');
writeln('| | | |');
writeln('| ',g,' | ',h,' | ',i,' |');
writeln;
if (a=b) and (b=c)
then writeln('Player',player,' WIN !!:)');
if (d=e) and (e=f)
then writeln('Player',player,' WIN !!:)');
if (g=h) and (h=i)
then writeln('Player',player,' WIN !!:)');
if (a=d) and (d=g)
then writeln('Player',player,' WIN !!:)');
if (b=e) and (e=f)
then writeln('Player',player,' WIN !!:)');
if(g=h) and (h=i)
then writeln('Player',player,' WIN !!:)');
if (a=e) and (e=i)
then writeln('Player',player,' WIN !!:)');
if (c=e) and (e=g)
then writeln('Player',player,' WIN !!:)');
end;
end.