帮帮看看我的free pascal 程序

来源:百度知道 编辑:UC知道 时间:2024/06/27 16:23:33
这个程序调试没有问题,但运行时有问题,好象是调用过程check时出了问题
program movegames;
uses crt;
label 1;
var
a:array [1..8,1..8] of 0..4;
k1,k2,b,c,v1,v2,v3,v4,n:integer;
yn:char;
procedure check;
var
n,i,j1,j2,j3:integer;
tf:boolean;
begin
tf:=true;
randomize;
while tf=true do
begin
for i:=1 to 8 do
begin
for j1:=1 to 8 do
for j2:=1 to 8 do
for j3:=1 to 8 do
if (a[i,j1]=a[i,j2]) and (a[i,j1]=a[i,j3]) and (a[i,j2]=a[i,j3]) then
begin
tf:=true;
a[i,j1]:=random(4);
a[i,j1]:=random(4);
a[i,j1]:=random(4);
n:=n+1;
end;
if (a[j1,i]=a[j2,i]) and (a[j1,i]=a[j3,i]) and (a[j2,i]=a[j3,i]) then
begin
tf:=true;
a[j1,i]:=random(4);
a[j2,i]:=random(4);
a[j3,i]:=

我也没有看明白 太 长咯
而且嵌套太多 ,原则 嵌套 只能有3层的.不然程序可读性就没有了.
你就说你想干嘛 我给你写程序 然后你自己 比对不同的地方 自己体会下吧.

没细看,代码太难懂.说一下程序的问题:
1.没注视,至少要写明算法,程序的目的
2.变量名字要使用有意义的英文名字或者缩写.