I added the Beep_() commands in the source.
Modify and upgrade it at your taste.

Code: Select all
;Program TURMITE
; https://en.wikipedia.org/wiki/Turmite
; A PB conversion of example program found at: https://es.wikipedia.org/wiki/DIV_Games_Studio
; September 2016, Psychophanta
Global orientacion=1,xa=160,ya=120,velocidad=10,a=1
InitSprite():InitKeyboard()
OpenWindowedScreen(OpenWindow(0,0,0,xa*2,ya*2,"Turmites",#PB_Window_SystemMenu|#PB_Window_ScreenCentered),0,0,xa*2,ya*2,1,0,0,#PB_Screen_NoSynchronization)
Procedure derecha()
orientacion+1
If orientacion>4:orientacion=1:EndIf
Select orientacion
Case 1:xa-a
Case 2:ya+a
Case 3:xa+a
Case 4:ya-a
EndSelect
EndProcedure
Procedure izquierda()
orientacion-1
If orientacion<1:orientacion=4:EndIf
Select orientacion
Case 1:xa+a
Case 2:ya-a
Case 3:xa-a
Case 4:ya+a
EndSelect
EndProcedure
Repeat
ExamineKeyboard()
If xa<0:xa=320:EndIf
If xa>320:xa=0:EndIf
If ya<0:ya=240:EndIf
If ya>240:ya=0:EndIf
If KeyboardPushed(#PB_Key_A):velocidad-1:If velocidad<1:velocidad=1:EndIf:EndIf
If KeyboardPushed(#PB_Key_D):velocidad+1:EndIf
StartDrawing(ScreenOutput())
DrawText(0,0,"Pulsa A para aumentar la velocidad")
DrawText(0,20,"Pulsa D para disminuir la velocidad")
Select Point(xa,ya)
Case 0:Beep_(200,10):Plot(xa,ya,$2222aa):derecha()
Case $2222aa:Beep_(400,10):Plot(xa,ya,$22aa22):derecha()
Case $22aa22:Beep_(600,10):Plot(xa,ya,$aa2222):izquierda():izquierda()
Case $aa2222:Beep_(800,10):Plot(xa,ya,0):izquierda():izquierda()
EndSelect
StopDrawing()
Delay(velocidad)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)