I am working on a basic debugger for procedurally generated floors for my roguelike project. However, I am running into a recurring issue that I am not sure how to fix, let alone what the cause may be. I am hoping that someone with a bit more knowledge on Axe can tell me what I am doing wrong, or if there is simply an issue with Axe or the calculator.

What I am attempting to do simply generate 9 rooms and take a look at the values of the room to see if they are acceptable. However I keep randomly getting stuck in a loop either when the program executes, or when I try to give it any input. Here is the full source:


Code:
.G
L₄+22→→°RoomStart
L₄+24→→°RoomWidth
L₄+26→→°RoomHeight
L₄+28→→°RoomX
L₄+30→→°RoomY
L₄+32→→°NewRoomX
L₄+34→→°NewRoomY
L₄+36→→°Invalid
L₄+38→→°UR
L₄+40→→°LL
L₄+42→→°NewRoomX2
L₄+44→→°NewRoomY2
L₄+20→→°Rooms
Fill(L₁,36,0)
0→Rooms→RoomX→RoomY→RoomHeight→RoomWidth
ClrDraw
GenFloor()
CheckFloor()
Main()
Lbl Main
While 1
Input()
EndIf getKey(15)
Return
Lbl CheckFloor
For(J,1,Rooms)
J*4+L₁-4→Z
J+(J*((J>0)*4))-4→Y
DrawText(1,Y,"(")
DrawInt(4,Y,{Z})
DrawText(13,Y,",")
DrawInt(16,Y,{Z+1})
DrawText(24,Y,")")
DrawInt(29,Y,{Z+2})
DrawInt(38,Y,{Z+3})
End
Return
Lbl GenFloor
While Rooms<9
GenRoom()
PlaceRoom()
End
Return
Lbl GenRoom
GetRoomStart()
While 1
GetRoomSide()→RoomWidth
End!If ChkRoomWidth()
While 1
GetRoomSide()→RoomHeight
End!If ChkRoomHeight()
Return
Lbl PlaceRoom
If Rooms<9
RoomY+RoomHeight-1→{RoomX+RoomWidth-1→{RoomY→{RoomX→{Rooms+1→Rooms*4+L₁-4}+1}+1}+1}
End
Return
Lbl GetRoomStart
6+(rand^(33))→RoomX
4+(rand^(40))→RoomY
Return
Lbl GetRoomSide
4+(rand^(9))
Return
Lbl ChkRoomWidth
(RoomX+RoomWidth-1>41)
Return
Lbl ChkRoomHeight
(RoomY+RoomHeight-1>43)
Return
Lbl DrawText
For(I,0,length(r₃)-1)
conj({r₃+I}-32*4+°CharSprites,L₄+50,4)
Fill(L₄+54,4,0)
DrawChar()
End
Return
Lbl DrawInt
r₃/10+16→{L₅}
r₃^10+16→{L₅+1}
For(I,0,1)
conj({L₅+I}*4+°CharSprites,L₄+50,4)
Fill(L₄+54,4,0)
DrawChar()
End
Return
Lbl DrawChar
Pt-On(r₁+(I*((I>0)*4)),r₂,L₄+50)
Return
Lbl Input
If getKey(9)
ClrDraw
0→Rooms
GenFloor()
End
Return
[]→°CharSprites
[0000000080800080]
[A0A00000A0E0E0A0]
[60C060C0A060C0A0]
[40A060E040400000]
[4080804040202040]
[A040A0000040E040]
[000040800000E000]
[0000008000204080]
[E0A0A0E0C04040E0]
[E020C0E0E06020E0]
[A0A0E020E08060E0]
[E080E0E0E0204040]
[E0A0E0E0E0A0E020]
[4000400040004080]
[0020402000E000E0]
[00804080E0200040]
[40A0E04060A0E0A0]
[C0E0A0E0E08080E0]
[C0A0A0E0E0C080E0]
[E0C08080E080A0C0]
[A0E0A0A0E04040E0]
[6020A040A0C0A0A0]
[808080E0E0E0A0A0]
[C0A0A0A0C0A0A060]
[C0A0E080E0A0E040]
[C0A0C0A0E08020E0]
[E0404040A0A0A060]
[A0A0A040A0A0E0E0]
[A040A0A0A0A04040]
[E02080E000000000]


The results are never consistent. Sometimes it runs perfectly and it outputs the data I want, but it doesn't update the screen with the new screen data. Exiting the loop works. Sometimes it does nothing. Just freezes up. And other times it outputs the data but is completely unresponsive. If anyone wants to look through the above and give their insights that would be greatly appreciated. Thanks.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement