XONIX
#1
? xonix ? ... XoniX ... !!! XONIX !!!

Code: (Select All)
Randomize Timer: b = Int(Rnd*15+5): a = Int(Rnd*15+5): ' xonix.bas
y = Int(Rnd*(b-3)+3): x = Int(Rnd*(a-3)+3): d=Int(Rnd*4+1)
'y = 5: x = 5: b = 10: a = 20: d=1 ' xonix.bas

For i = 1 To a: Print "#";: Next: Print ' area
For j = 1 To b-2: Print "#";: For k = 1 To a-2: Print ".";: Next: Print "#": Next
For i = 1 To a: Print "#";: Next

For q = 1 To 1000: _Delay .03: Locate y, x: Print " "

    If d=1 Then If (y-1 = 1) And (x+1 = a) Then d=3
    If d=1 Then If (y-1 > 1) And (x+1 = a) Then d=4
    If d=1 Then If (y-1 = 1) And (x+1 < a) Then d=2
    If d=1 Then y = y-1: x = x+1

    If d=2 Then If (y+1 = b) And (x+1 = a) Then d=4
    If d=2 Then If (y+1 < b) And (x+1 = a) Then d=3
    If d=2 Then If (y+1 = b) And (x+1 < a) Then d=1
    If d=2 Then y = y+1: x = x+1

    If d=3 Then If (y+1 = b) And (x-1 = 1) Then d=1
    If d=3 Then If (y+1 < b) And (x-1 = 1) Then d=2
    If d=3 Then If (y+1 = b) And (x-1 > 1) Then d=4
    If d=3 Then y = y+1: x = x-1

    If d=4 Then If (y-1 = 1) And (x-1 = 1) Then d=2
    If d=4 Then If (y-1 > 1) And (x-1 = 1) Then d=1
    If d=4 Then If (y-1 = 1) And (x-1 > 1) Then d=3
    If d=4 Then y = y-1: x = x-1

    Locate y, x: Print "@"
Next

qbasic qb64 xonix
gif 45 kB
   

https://en.wikipedia.org/wiki/Xonix
en.wikipedia.org/wiki/Xonix
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply


Messages In This Thread
XONIX - by DANILIN - 06-04-2022, 04:35 PM
RE: XONIX - by triggered - 06-04-2022, 05:16 PM
RE: XONIX - by DANILIN - 06-04-2022, 05:33 PM
RE: XONIX - by madscijr - 06-04-2022, 05:57 PM
RE: XONIX - by DANILIN - 06-04-2022, 06:07 PM
RE: XONIX - by bplus - 06-04-2022, 07:04 PM
RE: XONIX - by vince - 06-06-2022, 11:41 PM
RE: XONIX - by DANILIN - 06-07-2022, 07:55 PM



Users browsing this thread: 3 Guest(s)