|
|
-
sokoban()
Prgm
Local cmenu,put
Local a,i,j,jn,l,p,s,u,uu,v,vv,z
Define cmenu()=Prgm
Custom
Title "SOKOBAN"
Title "auf TI-92"
Title "Ver. 2.0"
EndCustm
CustmOn
EndPrgm
Define put(i,j)=Prgm
AndPic blank,10*i-10,10*j-10
If m[i,j]=1 Then
RclPic wall,10*i-10,10*j-10
Return
ElseIf m[i,j]=2 Then
RclPic box,10*i-10,10*j-10
Return
ElseIf m[i,j]=3 Then
RclPic store,10*i-10,10*j-10
Return
ElseIf m[i,j]=5 Then
RclPic sbox,10*i-10,10*j-10
Return
ElseIf m[i,j]=10 Then
RclPic fig,10*i-10,10*j-10
Return
ElseIf m[i,j]=13 Then
RclPic store, 10*i-10,10*j-10
RclPic fig,10*i-10,10*j-10
Return
EndIf
EndPrgm
setMode("Graph","3D"):ClrDraw:DispG
1»l
Lbl menu
Toolbar
Title "SOKOBAN"
Item "Level",setlev
Item "Start",play
Item "-----",menu
Item "Ende",end
Title "auf TI-92",about
Title "Ver. 2.0",menu
EndTBar
Lbl setlev
cmenu()
Dialog
Title "SOKOBAN"
Text ""
Text "Bitte Level wählen:"
DropDown "Level",seq(string(i),i,1,maxlevel),l
Text ""
EndDlog
Goto menu
Lbl play
cmenu()
ClrDraw
#("level0"&string(l))»m
For i,1,10
For j,1,15
If m[i,j]±0:put(i,j)
EndFor
EndFor
PxlText "Level "&string(l),22,155
PxlText "Steuerung:",37,155
PxlText "Cursortasten",47,155
PxlText "P = Status",62,167
PxlText "ESC = Abbruch",72,155
m[11,1]»u:m[11,2]»v:m[11,3]»p
0»z:0»s
Loop
u»uu:v»vv:0»a
While a=0
getKey()»a
EndWhile
If a=338:u-1»uu
If a=337:v-1»vv
If a=340:v+1»vv
If a=344:u+1»uu
If m[uu,vv]=0 or m[uu,vv]=3 Then
m[u,v]-10»m[u,v]
m[uu,vv]+10»m[uu,vv]
put(u,v)
put(uu,vv)
uu»u:vv»v
z+1»z
ElseIf m[uu,vv]=2 or m[uu,vv]=5 Then
If m[2*uu-u,2*vv-v]±0 and m[2*uu-u,2*vv-v]±3:Cycle
If m[uu,vv]=5:p+1»p
If m[2*uu-u,2*vv-v]=3:p-1»p
m[u,v]-10»m[u,v]
m[uu,vv]+8»m[uu,vv]
m[2*uu-u,2*vv-v]+2»m[2*uu-u,2*vv-v]
put(u,v)
put(uu,vv)
put(2*uu-u,2*vv-v)
uu»u:vv»v
z+1»z:s+1»s
EndIf
If a=112 Then
Dialog
Title "SOKOBAN"
Text ""
Text "Noch zu lagern: "&string(p)&when(p=1," Kiste"," Kisten")
Text "Züge: "&string(z)&" ("&string(s)&")"
Text ""
EndDlog
EndIf
If a=264 or p=0:Exit
EndLoop
If p=0 Then
"J"»jn
Dialog
Title "SOKOBAN"
Text ""
Text "Geschafft in "&string(z)&" ("&string(s)&") Zügen !"
Text ""
Request "Nächster Level ("&string(min(l+1,maxlevel))&")?",jn
Text ""
EndDlog
If jn="j" or jn="J" Then
min(l+1,maxlevel)»l
Goto play
EndIf
Else
"N"»jn
Dialog
Title "SOKOBAN"
Text ""
Text "Level abgebrochen !"
Request "Nochmal versuchen ?",jn
Text ""
EndDlog
If jn="j" or jn="J":Goto play
EndIf
Goto menu
Lbl end
cmenu()
Delvar m
Dialog
Title "SOKOBAN"
Text ""
Text "Hoffe, es hat Spaß gemacht !"
Text ""
EndDlog
Custom
EndCustm
DispHome
Return
Lbl about
cmenu()
Dialog
Title "SOKOBAN"
Text "**************************"
Text "* Programmiert von *"
Text "* Thomas Friedrich *"
Text "* (C)opyright 1999 *"
Text "**************************"
EndDlog
Goto menu
EndPrgm
|