Pascal小游戏 俄罗斯方块

俄罗斯方块已经成为了和“Hello World”一样的程序了吧?

不要直接复制,可能需要事先 Format.

program cube;
uses crt,graph,dos;
var gd,gm:smallint;
fillin:fillpatterntype;
board:array[0..26,0..26]of boolean;
cube1,cube2,cube3,cube4:array[1..2]of byte;
h,min,s,ss,ls,i,j,k,r,lin,cu1,cu2,cu3,cu4,c,t1,t2,t:word;
x,y,m:byte;
moving:boolean;
ch:char;
procedure fail;
begin
gotoxy(1,1);
clrscr;
closegraph;
writeln(‘Fail‘);
readln;
halt;
end;
procedure do1;
begin
setcolor(blue);setbkcolor(blue);setfillpattern(fillin,blue);
rectangle((cube1[2]-1)*20,(cube1[1]-1)*20,(cube1[2]-1)*20+20,(cube1[1]-1)*20+20);
bar((cube1[2]-1)*20,(cube1[1]-1)*20,(cube1[2]-1)*20+20,(cube1[1]-1)*20+20);
rectangle((cube2[2]-1)*20,(cube2[1]-1)*20,(cube2[2]-1)*20+20,(cube2[1]-1)*20+20);
bar((cube2[2]-1)*20,(cube2[1]-1)*20,(cube2[2]-1)*20+20,(cube2[1]-1)*20+20);
rectangle((cube3[2]-1)*20,(cube3[1]-1)*20,(cube3[2]-1)*20+20,(cube3[1]-1)*20+20);
bar((cube3[2]-1)*20,(cube3[1]-1)*20,(cube3[2]-1)*20+20,(cube3[1]-1)*20+20);
rectangle((cube4[2]-1)*20,(cube4[1]-1)*20,(cube4[2]-1)*20+20,(cube4[1]-1)*20+20);
bar((cube4[2]-1)*20,(cube4[1]-1)*20,(cube4[2]-1)*20+20,(cube4[1]-1)*20+20);
end;
procedure do2;
begin
setcolor(green);setbkcolor(green);setfillpattern(fillin,green);
rectangle((cube1[2]-1)*20,(cube1[1]-1)*20,(cube1[2]-1)*20+20,(cube1[1]-1)*20+20);
bar((cube1[2]-1)*20,(cube1[1]-1)*20,(cube1[2]-1)*20+20,(cube1[1]-1)*20+20);
rectangle((cube2[2]-1)*20,(cube2[1]-1)*20,(cube2[2]-1)*20+20,(cube2[1]-1)*20+20);
bar((cube2[2]-1)*20,(cube2[1]-1)*20,(cube2[2]-1)*20+20,(cube2[1]-1)*20+20);
rectangle((cube3[2]-1)*20,(cube3[1]-1)*20,(cube3[2]-1)*20+20,(cube3[1]-1)*20+20);
bar((cube3[2]-1)*20,(cube3[1]-1)*20,(cube3[2]-1)*20+20,(cube3[1]-1)*20+20);
rectangle((cube4[2]-1)*20,(cube4[1]-1)*20,(cube4[2]-1)*20+20,(cube4[1]-1)*20+20);
bar((cube4[2]-1)*20,(cube4[1]-1)*20,(cube4[2]-1)*20+20,(cube4[1]-1)*20+20);
end;
begin
randomize;
cursoroff;
getfillpattern(fillin);
c:=1;
writeln(‘Easiest <--‘);
writeln(‘Very Easy ‘);
writeln(‘Easy ‘);
writeln(‘Medium ‘);
writeln(‘Hard ‘);
writeln(‘Very Hard ‘);
writeln(‘Hardest ‘);
writeln(‘Random ‘);
repeat
if keypressed then
case readkey of
#72:begin gotoxy(11,c);write(‘ ‘);if c=1 then c:=8 else dec(c);gotoxy(11,c);write(‘<--‘);end;
#80:begin gotoxy(11,c);write(‘ ‘);if c=8 then c:=1 else inc(c);gotoxy(11,c);write(‘<--‘);end;
‘ ‘:break;
end;
until false;
if c=8 then c:=1+random(7);
case c of
1:begin x:=25;y:=25;m:=13;end;
2:begin x:=21;y:=21;m:=11;end;
3:begin x:=17;y:=17;m:=9;end;
4:begin x:=15;y:=15;m:=8;end;
5:begin x:=13;y:=13;m:=7;end;
6:begin x:=11;y:=11;m:=6;end;
7:begin x:=7;y:=11;m:=6;end;
end;
gd:=1;
gm:=detect;
initgraph(gm,gd,‘temp‘);
setbkcolor(red);
cleardevice;
setcolor(blue);
setbkcolor(blue);
setfillpattern(fillin,blue);
rectangle(0,0,y*20,x*20);
bar(0,0,y*20,x*20);
gettime(h,min,s,ss);
ls:=s;
moving:=false;
for i:=0 to x+1 do for j:=0 to y+1 do board[i,j]:=true;
for i:=1 to x do for j:=1 to y do board[i,j]:=false;
clrscr;writeln(‘The game will start in 5 seconds...‘);delay(5000);clrscr;
repeat
gettime(h,min,s,ss);
if(s<>ls)and(moving)then
begin
if board[cube1[1]+1,cube1[2]]then moving:=false;
if board[cube2[1]+1,cube2[2]]then moving:=false;
if board[cube3[1]+1,cube3[2]]then moving:=false;
if board[cube4[1]+1,cube4[2]]then moving:=false;
if moving then
begin
do1;
setcolor(green);setbkcolor(green);setfillpattern(fillin,green);
rectangle((cube1[2]-1)*20,cube1[1]*20,(cube1[2]-1)*20+20,cube1[1]*20+20);
bar((cube1[2]-1)*20,cube1[1]*20,(cube1[2]-1)*20+20,cube1[1]*20+20);
rectangle((cube2[2]-1)*20,cube2[1]*20,(cube2[2]-1)*20+20,cube2[1]*20+20);
bar((cube2[2]-1)*20,cube2[1]*20,(cube2[2]-1)*20+20,cube2[1]*20+20);
rectangle((cube3[2]-1)*20,cube3[1]*20,(cube3[2]-1)*20+20,cube3[1]*20+20);
bar((cube3[2]-1)*20,cube3[1]*20,(cube3[2]-1)*20+20,cube3[1]*20+20);
rectangle((cube4[2]-1)*20,cube4[1]*20,(cube4[2]-1)*20+20,cube4[1]*20+20);
bar((cube4[2]-1)*20,cube4[1]*20,(cube4[2]-1)*20+20,cube4[1]*20+20);
cube1[1]:=cube1[1]+1;cube2[1]:=cube2[1]+1;cube3[1]:=cube3[1]+1;cube4[1]:=cube4[1]+1;
end
else
begin
board[cube1[1],cube1[2]]:=true;
board[cube2[1],cube2[2]]:=true;
board[cube3[1],cube3[2]]:=true;
board[cube4[1],cube4[2]]:=true;
for i:=1 to x do
begin
lin:=0;
for j:=1 to y do
if board[i,j]then inc(lin);
if lin=y then
begin
setcolor(blue);setbkcolor(blue);setfillpattern(fillin,blue);
rectangle(0,0,y*20,i*20);bar(0,0,y*20,i*20);
setcolor(green);setbkcolor(green);setfillpattern(fillin,green);
for k:=1 to y do
if board[i-1,k]then
for j:=i downto 2 do
begin
board[j,k]:=board[j-1,k];
if board[j-1,k]then begin rectangle((k-1)*20,(j-1)*20,(k-1)*20+20,(j-1)*20+20);
bar((k-1)*20,(j-1)*20,(k-1)*20+20,(j-1)*20+20);end;
end
else
for j:=i downto 3 do
begin
board[j,k]:=board[j-2,k];
if board[j-2,k]then begin rectangle((k-1)*20,(j-1)*20,(k-1)*20+20,(j-1)*20+20);
bar((k-1)*20,(j-1)*20,(k-1)*20+20,(j-1)*20+20);end;
end
end;
end;
end;
ls:=s;
end;
if moving=false then
begin
r:=1+random(7);c:=0;
case r of
1:begin for i:=1 to 2 do for j:=m-1 to m do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m-1;cube2[1]:=1;cube2[2]:=m;cube3[1]:=2;cube3[2]:=m-1;cube4[1]:=2;cube4[2]:=m;do2;
end;
2:begin for i:=1 to 2 do for j:=m-1 to m+1 do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m;cube2[1]:=2;cube2[2]:=m-1;cube3[1]:=2;cube3[2]:=m;cube4[1]:=2;cube4[2]:=m+1;do2;
end;
3:begin for j:=m-2 to m+1 do if board[1,j]then fail;
cube1[1]:=1;cube1[2]:=m-2;cube2[1]:=1;cube2[2]:=m-1;cube3[1]:=1;cube3[2]:=m;cube4[1]:=1;cube4[2]:=m+1;do2;
end;
4:begin for i:=1 to 2 do for j:=m-1 to m+1 do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m+1;cube2[1]:=2;cube2[2]:=m-1;cube3[1]:=2;cube3[2]:=m;cube4[1]:=2;cube4[2]:=m+1;do2;
end;
5:begin for i:=1 to 2 do for j:=m-1 to m+1 do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m;cube2[1]:=1;cube2[2]:=m-1;cube3[1]:=2;cube3[2]:=m;cube4[1]:=2;cube4[2]:=m+1;do2;
end;
6:begin for i:=1 to 2 do for j:=m-1 to m+1 do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m-1;cube2[1]:=2;cube2[2]:=m-1;cube3[1]:=2;cube3[2]:=m;cube4[1]:=2;cube4[2]:=m+1;do2;
end;
7:begin for i:=1 to 2 do for j:=m-1 to m+1 do if board[i,j]then fail;
cube1[1]:=1;cube1[2]:=m;cube2[1]:=1;cube2[2]:=m+1;cube3[1]:=2;cube3[2]:=m;cube4[1]:=2;cube4[2]:=m-1;do2;
end;
end;
moving:=true;
end;
if keypressed then
case upcase(readkey)of
‘ ‘:begin repeat if keypressed then ch:=readkey;if upcase(ch)=‘ ‘then break;until false;end;
#80:begin cu1:=0;cu2:=0;cu3:=0;cu4:=0;
while(board[cube1[1]+cu1,cube1[2]]=false)do inc(cu1);
while(board[cube2[1]+cu2,cube2[2]]=false)do inc(cu2);
while(board[cube3[1]+cu3,cube3[2]]=false)do inc(cu3);
while(board[cube4[1]+cu4,cube4[2]]=false)do inc(cu4);do1;
if cu1<cu2 then t1:=cu1 else t1:=cu2;if cu3<cu4 then t2:=cu3 else t2:=cu4;if t1<t2 then t:=t1 else t:=t2;
t:=t-1;if t>5 then t:=5;
inc(cube1[1],t);inc(cube2[1],t);inc(cube3[1],t);inc(cube4[1],t);do2;end;
#75:begin
if board[cube1[1],cube1[2]-1] then continue;if board[cube2[1],cube2[2]-1] then continue;
if board[cube3[1],cube3[2]-1] then continue;if board[cube4[1],cube4[2]-1] then continue;
do1;cube1[2]:=cube1[2]-1;cube2[2]:=cube2[2]-1;cube3[2]:=cube3[2]-1;cube4[2]:=cube4[2]-1;do2;
end;
#77:begin
if board[cube1[1],cube1[2]+1] then continue;if board[cube2[1],cube2[2]+1] then continue;
if board[cube3[1],cube3[2]+1] then continue;if board[cube4[1],cube4[2]+1] then continue;
do1;cube1[2]:=cube1[2]+1;cube2[2]:=cube2[2]+1;cube3[2]:=cube3[2]+1;cube4[2]:=cube4[2]+1;do2;
end;
#72:begin
case r of
2:case c mod 4 of
0:begin if board[cube2[1],cube2[2]+2]then continue;
if board[cube3[1]-1,cube3[2]+1]then continue;if board[cube4[1]-2,cube4[2]]then continue;
do1;cube2[2]:=cube2[2]+2;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]+1;cube4[1]:=cube4[1]-2;do2;end;
1:begin if board[cube2[1]-2,cube2[2]]then continue;
if board[cube3[1]-1,cube3[2]-1]then continue;if board[cube4[1],cube4[2]-2]then continue;
do1;cube2[1]:=cube2[1]-2;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]-1;cube4[2]:=cube4[2]-2;do2;end;
2:begin if board[cube2[1],cube2[2]-2]then continue;
if board[cube3[1]+1,cube3[2]-1]then continue;if board[cube4[1]+2,cube4[2]]then continue;
do1;cube2[2]:=cube2[2]-2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]-1;cube4[1]:=cube4[1]+2;do2;end;
3:begin if board[cube2[1]+2,cube2[2]]then continue;
if board[cube3[1]+1,cube3[2]+1]then continue;if board[cube4[1],cube4[2]+2]then continue;
do1;cube2[1]:=cube2[1]+2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]+1;cube4[2]:=cube4[2]+2;do2;end;
end;
3:case c mod 2 of
0:begin if board[cube1[1]+1,cube1[2]+1]then continue;
if board[cube3[1]-1,cube3[2]-1]then continue;if board[cube4[1]-2,cube4[2]-2]then continue;
do1;cube1[1]:=cube1[1]+1;cube1[2]:=cube1[2]+1;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]-1;
cube4[2]:=cube4[2]-2;cube4[1]:=cube4[1]-2;do2;end;
1:begin if board[cube1[1]-1,cube1[2]-1]then continue;
if board[cube3[1]+1,cube3[2]+1]then continue;if board[cube4[1]+2,cube4[2]+2]then continue;
do1;cube1[1]:=cube1[1]-1;cube1[2]:=cube1[2]-1;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]+1;
cube4[2]:=cube4[2]+2;cube4[1]:=cube4[1]+2;do2;end;
end;
4:case c mod 4 of
0:begin if board[cube1[1]-1,cube1[2]-1]then continue;if board[cube2[1],cube2[2]+2]then continue;
if board[cube3[1]-1,cube3[2]+1]then continue;if board[cube4[1]-2,cube4[2]]then continue;
do1;cube1[1]:=cube1[1]-1;cube1[2]:=cube1[2]-1;cube2[2]:=cube2[2]+2;cube3[1]:=cube3[1]-1;
cube3[2]:=cube3[2]+1;cube4[1]:=cube4[1]-2;do2;end;
1:begin if board[cube1[1]+1,cube1[2]-1]then continue;if board[cube2[1]-2,cube2[2]]then continue;
if board[cube3[1]-1,cube3[2]-1]then continue;if board[cube4[1],cube4[2]-2]then continue;
do1;cube1[1]:=cube1[1]+1;cube1[2]:=cube1[2]-1;
cube2[1]:=cube2[1]-2;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]-1;cube4[2]:=cube4[2]-2;do2;end;

2:begin if board[cube1[1]+1,cube1[2]+1]then continue;if board[cube2[1],cube2[2]-2]then continue;
if board[cube3[1]+1,cube3[2]-1]then continue;if board[cube4[1]+2,cube4[2]]then continue;
do1;cube1[1]:=cube1[1]+1;cube1[2]:=cube1[2]+1;
cube2[2]:=cube2[2]-2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]-1;cube4[1]:=cube4[1]+2;do2;end;
3:begin if board[cube1[1]-1,cube1[2]+1]then continue;if board[cube2[1]+2,cube2[2]]then continue;
if board[cube3[1]+1,cube3[2]+1]then continue;if board[cube4[1],cube4[2]+2]then continue;
do1;cube1[1]:=cube1[1]-1;cube1[2]:=cube1[2]+1;
cube2[1]:=cube2[1]+2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]+1;cube4[2]:=cube4[2]+2;do2;end;
end;
5:case c mod 2 of
0:begin if board[cube2[1]+1,cube2[2]+1]then continue;
if board[cube3[1]-1,cube3[2]+1]then continue;if board[cube4[1]-2,cube4[2]]then continue;
do1;cube2[1]:=cube2[1]+1;cube2[2]:=cube2[2]+1;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]+1;cube4[1]:=cube4[1]-2;do2;end;
1:begin if board[cube2[1]-1,cube2[2]-1]then continue;
if board[cube3[1]+1,cube3[2]-1]then continue;if board[cube4[1]+2,cube4[2]]then continue;
do1;cube2[1]:=cube2[1]-1;cube2[2]:=cube2[2]-1;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]-1;cube4[1]:=cube4[1]+2;do2;end;
end;
6:case c mod 4 of
0:begin if board[cube1[1]+1,cube1[2]+1]then continue;if board[cube2[1],cube2[2]+2]then continue;
if board[cube3[1]-1,cube3[2]+1]then continue;if board[cube4[1]-2,cube4[2]]then continue;
do1;cube1[1]:=cube1[1]+1;cube1[2]:=cube1[2]+1;cube2[2]:=cube2[2]+2;cube3[1]:=cube3[1]-1;
cube3[2]:=cube3[2]+1;cube4[1]:=cube4[1]-2;do2;end;
1:begin if board[cube1[1]-1,cube1[2]+1]then continue;if board[cube2[1]-2,cube2[2]]then continue;
if board[cube3[1]-1,cube3[2]-1]then continue;if board[cube4[1],cube4[2]-2]then continue;
do1;cube1[1]:=cube1[1]-1;cube1[2]:=cube1[2]+1;
cube2[1]:=cube2[1]-2;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]-1;cube4[2]:=cube4[2]-2;do2;end;
2:begin if board[cube1[1]-1,cube1[2]-1]then continue;if board[cube2[1],cube2[2]-2]then continue;
if board[cube3[1]+1,cube3[2]-1]then continue;if board[cube4[1]+2,cube4[2]]then continue;
do1;cube1[1]:=cube1[1]-1;cube1[2]:=cube1[2]-1;
cube2[2]:=cube2[2]-2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]-1;cube4[1]:=cube4[1]+2;do2;end;
3:begin if board[cube1[1]+1,cube1[2]-1]then continue;if board[cube2[1]+2,cube2[2]]then continue;
if board[cube3[1]+1,cube3[2]+1]then continue;if board[cube4[1],cube4[2]+2]then continue;
do1;cube1[1]:=cube1[1]+1;cube1[2]:=cube1[2]-1;
cube2[1]:=cube2[1]+2;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]+1;cube4[2]:=cube4[2]+2;do2;end;
end;
7:case c mod 2 of
0:begin if board[cube2[1]-1,cube2[2]-1]then continue;
if board[cube3[1]-1,cube3[2]+1]then continue;if board[cube4[1],cube4[2]+2]then continue;
do1;cube2[1]:=cube2[1]-1;cube2[2]:=cube2[2]-1;cube3[1]:=cube3[1]-1;cube3[2]:=cube3[2]+1;cube4[2]:=cube4[2]+2;do2;end;
1:begin if board[cube2[1]+1,cube2[2]+1]then continue;
if board[cube3[1]+1,cube3[2]-1]then continue;if board[cube4[1],cube4[2]-2]then continue;
do1;cube2[1]:=cube2[1]+1;cube2[2]:=cube2[2]+1;cube3[1]:=cube3[1]+1;cube3[2]:=cube3[2]-1;cube4[2]:=cube4[2]-2;do2;end;
end;
end;
inc(c);
end;
end;
until false;
end.
program project1;
{$APPTYPE GUI}
{$MODE DELPHI}
uses Windows, Messages, SysUtils,strings;
const AppName = ‘ET_PureObjectPascalWindow‘;
function WindowProc(Window: HWND;
AMessage: UINT; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall; export;
var dc: HDC;
ps: TPaintStruct;
r: TRect;
begin Result := 0;
case AMessage of
WM_PAINT: begin
dc := BeginPaint(Window, ps);
GetClientRect(Window, r);
DrawText(dc, ‘不要按下鼠标‘, -1, r, DT_SINGLELINE or DT_CENTER or DT_VCENTER);
EndPaint(Window, ps);
end;
WM_DESTROY: begin
PostQuitMessage(0);
end;
WM_LBUTTONDOWN:Begin {按下鼠标左键的消息}
MessageBox(0, ‘叫你不要按你还按!‘, nil, mb_Ok);
Exit;
End;
else Result := DefWindowProc(Window, AMessage, WParam, LParam);
end;
end;
Function WinRegister: Boolean;
var
WindowClass : WndClass;
Begin
With WindowClass Do
Begin
Style := cs_hRedraw Or cs_vRedraw;
lpfnWndProc := WndProc(@WindowProc);
cbClsExtra := 0;
cbWndExtra := 0;
hInstance := system.MainInstance;
hIcon := LoadIcon (0,idi_Application);
hCursor := LoadCursor (0,idc_Arrow);
hbrBackground := GetStockObject(GRAY_BRUSH);
lpszMenuName := Nil;
lpszClassName := AppName;
End;
WinRegister := RegisterClass (WindowClass)<>0;
End;
function WinCreate: HWND;
var hWindow: HWND;
begin
hWindow := CreateWindow(AppName, ‘看到了吗‘, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,0, 0, MainInstance, nil);
if hWindow <> 0 then
begin
ShowWindow(hWindow, CmdShow);
ShowWindow(hWindow, SW_SHOW);
UpdateWindow(hWindow);
end;
Result := hWindow;
end;
var AMessage: TMsg;
hWindow: HWND;
begin
if not WinRegister then begin
MessageBox(0, ‘WinRegister failed‘, nil, MB_OK);
Exit;
end;
hWindow := WinCreate;
if LongInt(hWindow) = 0 then begin
MessageBox(0, ‘WinCreate failed‘, nil, MB_OK);
Exit;
end;
while GetMessage(AMessage, 0, 0, 0) do
begin
TranslateMessage(AMessage);
DispatchMessage(AMessage);
end;
Halt(AMessage.wParam);
end.

Pascal小游戏 俄罗斯方块

时间: 2024-10-31 01:44:04

Pascal小游戏 俄罗斯方块的相关文章

Pascal小游戏 俄罗斯方块怀旧版

俄罗斯方块怀旧版(注释版) {$APPTYPE GUI}{$MODE DELPHI}program WinPiece; usesWindows; constAppName = 'WinPiece';pm = 25; vardc : hdc;AMessage : Msg;hWindow: HWnd;hPen ,hBrush : longword;intNextPiece, intCurPiece,intTempPiece : longint;BigMap : array [0..11,-4..20

Pascal小游戏 双人射击

一个双人的游戏 Pascal源码附上 只要俩人不脑残,一下午玩不完...又是控制台游戏中的一朵奇葩. Free Pascal 射击游戏 Program shooting_game; uses crt; const cz:array[1..4,1..2] of -1..1=((0,1),(1,0),(0,-1),(-1,0)); var i,j,xz1,yz1,y1,xz2,yz2,y2,t1,t2,t3,k,v1,v2:integer;     ch:char;     a:array[1..2

Pascal小游戏 贪吃蛇

一段未完成的Pascal贪吃蛇 说这段代码未完成其实是没有源代码格式化,FP中一行最多只有255字符宽. uses crt; const screenwidth=50; screenheight=24; wallchar='#'; snakechar='*'; ; type point=record x,y:integer; end; var snake:array [0..500] of point; map:array [0..screenwidth,0..screenheight] of

Pascal小游戏 文件的产生

一个整人的Pascal小程序 运行之后硬盘里面会有一大堆垃圾,当然更好的方法当然不是这样做! var a,b,c,d:char;beginfor a:='0' to '9' dofor b:='0' to '9' dofor c:='0' to '9' dofor d:='0' to '9' dobeginassign(output,'C:\'+a+b+c+d+'.txt');rewrite(output);write(1);close(output);assign(output,'D:\'+a

Pascal小游戏 打飞机

一个经典的打飞机游戏(1)Pascal代码 十分经典,有一种街机的感觉 奇葩青年的又一控制台神作. uses crt; type list=record         ty,ax:integer;         end;      xy=record         bx,by:integer;         end;      l1=array[1..4,1..5]of char;      l2=array[1..5,1..6]of char;      l3=array[1..8,1

Pascal小游戏 随机函数

一个被人写滥了的小程序,新手学习,Pascal By Chaobs 初学者可以用它来学习随机函数的运用,当然你完全可以自己写一个随机函数. var   player1,player2:longint;   a,b,l,o,i,v:longint; w:boolean;begin   randomize;   write('A=');readln(player1);   write('B=');readln(player2);   b:=1;   i:=1;   while(player1>0)a

Pascal小游戏 不要消灭星星

不要消灭星星 Pascal小游戏 Chaobs改编自pascal吧 控制台小游戏嘛,就当是练习一下结构化的写法. program wxtw; uses crt; type      zbdy=record      x,y:integer; end; var n,i,x,y,t,sjs:integer;    ml:char; zb: array [1..12] of zbdy; begin    randomize;    sjs:=random(3);    zb[1].x:=15; zb[

Pascal小游戏 井字棋

一个很经典的井字棋游戏 Pascal源码Chaobs奉上 注意:1.有的FP版本不支持汉语,将会出现乱码.2.别想赢电脑了,平手不错了. 井字过三关: program TicTacToe; uses crt; var a:Array [1..3] of Array [1..3] of char; b:Array [1..3] of Array [1..3] of integer; i,n,g,e,p:integer; t:text; c:char; o:integer; r:integer; s

Pascal小游戏之奇葩的RPG

Pascal吧友作品 一个小RPG Chaobs转载 varplife,plifemax,patt,pre:integer;gr,ex,exmax:integer;alife,alife1,aatt,are:integer;name,fname:string;na:text;code,co:string;dz:integer;money:longint;mp,mpmax:integer;red,blue,knife,clothes:integer;i:integer;god:array[1..1