易码技术论坛

 找回密码
 加入易码
搜索
查看: 476383|回复: 2

我用YABASIC做的[数独]

[复制链接]
发表于 2007-10-28 14:55:55 | 显示全部楼层 |阅读模式
dim m$(9,11),o$(9)
ad$="a:/download/shudu/"
goto 8
6
open 1,ad$+"sd.dat","r"
for i=1 to 9
input#1 o$(i)
next
close#1
return
1
dx=64+18*i
dy=18*j-15
poke "dm",0
box dx+2,dy+2 to dx+16,dy+16
gosub 2
a$=inkey$
gosub 4
if a$="key80" then j=j-1
if j<3 then j=11:fi
fi
if a$="key81" then j=j+1
if j>11 then j=3:fi
fi
if a$="key82" then i=i-1
if i<1 then i=9:fi
fi
if a$="key83" then i=i+1
if i>9 then i=1:fi
fi
a=val(a$)
if (a>0 and a<10) or a$="key89" then gosub 3:fi
if a$="s" then goto s:fi
if a$="key1b" then if s0=1 then goto 7:else goto 9:fi:fi
goto 1
3
if mid$(m$(i,j),2,1)<>"" then return:fi
if a$="key89" then m$(i,j)=""
else m$(i,j)=str$(a,"#")
fi
return
4
if (i<4 and j<6) or (i<4 and j>8) or (i>3 and i<7 and j>5 and j<9) or (i>6 and j<6) or (i>6 and j>8) then poke "dm",5:fi
box dx,dy to dx+18,dy+18
2
poke "dm",3
text dx+8-len(m$(i,j)),dy+2+len(left$(m$(i,j),2)),left$(m$(i,j),2)
poke "dm",0
return
5
clear window
box 81,38 to 245,202
for i=1 to 9
for j=3 to 11
if s0=0 then input#1 m$(i,j)
else m$(i,j)=""
fi
dx=64+18*i
dy=18*j-15
gosub 4
next
next
close#1
return
9
for i=1 to 9
for j=3 to 10
a=val(right$(m$(i,j),1))
for x=j+1 to 11
if a=val(right$(m$(i,x),1)) then ?@(1,18)"错误!":goto 7:fi
next
next
next
for j=3 to 11
for i=1 to 8
a=val(right$(m$(i,j),1))
for x=i+1 to 9
if a=val(right$(m$(x,j),1)) then ?@(1,18)"错误!":goto 7:fi
next
next
next
?@(1,18)"恭喜你答对了!"
7
?@(1,19)"exit?[y/n]   "
a$=inkey$
if a$<>"y" then
?@(1,18)"             "
?@(1,19)"             "
i=1:j=3
goto 1
fi
8
clear window
?@(24,4)"数独"
?@(20,7)"a.进入游戏"
?@(20,9)"b.载入游戏"
?@(20,11)"c.编辑地图"
?@(40,17)"kekeyu制作"
10
a$=inkey$
a=asc(a$)
if a$="key1b" then end:fi
if a<97 or a>99 then goto 10:fi
a=100-a
on a gosub p,l,k
i=1
j=3
goto 1
label k
s0=0
input @(33,7)"选择地图[1-30]:",t
open 1,ad$+"k"+str$(t,"##"),"r"
gosub 5
return
label l
s0=0
input @(33,9)"存档名:",c$
open 1,ad$+c$+".sd","r"
gosub 5
return
label p
s0=1
gosub 5
return
label s
if s0=0 then
input @(1,18)"存档名:",c$
open 1,ad$+c$+".sd","cw"
else gosub 6
input @(1,18)"地图编号:",t
open 1,ad$+"k"+str$(t,"##"),"cw"
fi
?@(1,19)"saving..."
for i=1 to 9
?@(10,19)i*10,"%"
for j=3 to 11
if s0=0 then ?#1 m$(i,j)
else ?#1 o$(val(m$(i,j)))+m$(i,j)
fi
next
next
close#1
?@(10,19)"ok!"
inkey$
goto 7


200793017362719401.rar (5.49 KB, 下载次数: 1060)
发表于 2007-10-28 15:46:27 | 显示全部楼层
YABASIC??
恕我孤落寡闻……
发表于 2007-10-28 15:47:57 | 显示全部楼层
什么机型?
您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

Archiver|手机版|小黑屋|EMAX Studio

GMT+8, 2024-3-29 22:52 , Processed in 0.017105 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表