主题:数独问题 紧急求救
procedure shudushengcheng(var b:shudufangge1);
var
i,j,x,y,k,l,shu,o1,p1,o2,p2,l1,l2:integer;
n,m:fenxi;
begin
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
fenxichushihua(n);
fenxichushihua(m);
for k:=1 to nandu do
begin
randomize;
//随机方格位置
l:=random(n[10]-1)+1;
x:=n[l] div 3;
y:=n[l] mod 3;
shanchu(n,l);
randomize;
//不符合规则的剔除
for o1:=1 to 3-i do
begin
for o2:=1 to 3 do
shanchu(m,b[i,o1][x,o2]);
end;
for p1:=1 to 3 do
begin
for p2:=1 to 3 do
shanchu(m,b[p1,j][p2,y]);
end;
for l1:=1 to 3 do
for l2:=1 to 3 do
shanchu(m,b[i,j][l1,l2]);
//摇数独
shu:=random(m[10]-1)+1;
b[i,j][x,y]:=shu;
end;
end;
end;
end;
///程序定义
type
fenxi=array [1..10] of 0..9;
fangge=array [1..3,1..3] of 1..9;
shududa=array [1..9,1..9] of 1..9;
shudufangge1=array [1..3,1..3] of fangge;
var
shudufangge:shudufangge1;
shudushuchu:shududa;
shudujisuan:array [1..9,1..9] of fenxi;
shengcheng:fenxi;
nandu:integer;
拼图是九宫格(即3格宽×3格高)的正方形状,每一格又细分为一个九宫格。在每一个小九宫格中,分别填上1至9的数字,让整个大九宫格每一列、每一行的数字都不重复。 数独的玩法逻辑简单,数字排列方式千变万化。不少教育者认为数独是锻炼脑筋的好方法。
http://spaces.msn.com/ivansoon/blog/cns!A9C1B895E95807F2!2891.entry
帮忙+30
var
i,j,x,y,k,l,shu,o1,p1,o2,p2,l1,l2:integer;
n,m:fenxi;
begin
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
fenxichushihua(n);
fenxichushihua(m);
for k:=1 to nandu do
begin
randomize;
//随机方格位置
l:=random(n[10]-1)+1;
x:=n[l] div 3;
y:=n[l] mod 3;
shanchu(n,l);
randomize;
//不符合规则的剔除
for o1:=1 to 3-i do
begin
for o2:=1 to 3 do
shanchu(m,b[i,o1][x,o2]);
end;
for p1:=1 to 3 do
begin
for p2:=1 to 3 do
shanchu(m,b[p1,j][p2,y]);
end;
for l1:=1 to 3 do
for l2:=1 to 3 do
shanchu(m,b[i,j][l1,l2]);
//摇数独
shu:=random(m[10]-1)+1;
b[i,j][x,y]:=shu;
end;
end;
end;
end;
///程序定义
type
fenxi=array [1..10] of 0..9;
fangge=array [1..3,1..3] of 1..9;
shududa=array [1..9,1..9] of 1..9;
shudufangge1=array [1..3,1..3] of fangge;
var
shudufangge:shudufangge1;
shudushuchu:shududa;
shudujisuan:array [1..9,1..9] of fenxi;
shengcheng:fenxi;
nandu:integer;
拼图是九宫格(即3格宽×3格高)的正方形状,每一格又细分为一个九宫格。在每一个小九宫格中,分别填上1至9的数字,让整个大九宫格每一列、每一行的数字都不重复。 数独的玩法逻辑简单,数字排列方式千变万化。不少教育者认为数独是锻炼脑筋的好方法。
http://spaces.msn.com/ivansoon/blog/cns!A9C1B895E95807F2!2891.entry
帮忙+30