Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Book for sanity/insanity break: "10 PRINT CHR$(205.5+RND(1)); : GOTO 10"
#1
https://10print.org/10_PRINT_121114.pdf?...786I9Um03Q
Reply
#2
Bug 
Makes me glad I never had a C64. What a shame it took ten authors of this so-called book, to give an in-depth explanation of a program that is completely worthless but gives interesting output. From QuickBASIC to QB64 and CP437 the same program gives a very boring output. A double-horizontal line. On the SCREEN 0 screenie. On a Linux terminal this wouldn't do anything useful. I couldn't run this program on my Tandy1000HX because I would have had to reboot that computer afterward. :/
Reply
#3
This was tricky to do!

[Image: 2023-08-22-003039-1366x768-scrot.png]

Tricky because:
  • was using Slackware Linux clone,
  • used MATE Terminal for display,
  • used Freebasic to make sure it could do Unicode,
  • used Gucharmap to figure out QB64-AS-INTEGER range Unicode character codes and turn them into UTF-8,
  • has no desktop "screenshooter" and therefore had to write a "bash" script, and execute that, which runs the executable created by Freebasic and then "scrot" to create the screenshot.

Probably the program works if "$CONSOLE:ONLY" is added at the top.

I had written a similar program that does random ASCII art business for a few seconds and then scrolls right to left. It involved using those total-diagonal characters but I created them all for my program out of raster techniques. My work looked funnier than the screenshot above presents, which is near perfect although a bit too thin for some people.
Reply
#4
In Julia:

Code: (Select All)
for i = 1:3000
    print(Char(rand((9585,9586))))
end
Reply
#5
I wrote some code for using those mazes for walking around in. I either can't find it or I took all the angles and made them rectilinear:

It's a 2 tile system:
Code: (Select All)
' b+ mod NOVARSEG code for 2 tiler 2021-01-25
' 2021-01-27  mod this for navigation and toggle paint jobs red and back or blue and black as per NOVARSEG
' 2021-01-27  add spacebar to reverse a cells walls a sound will buzz if not inside a cell with walls
'             The color your standing on will PAINT the new roadway if the walls switch.

Const W = 1024, H = 700 ' screen width and height and color for lines and border check
Screen _NewImage(W, H, 32)
_Delay .25 'wait for screen to set
_ScreenMove _Middle 'then center it in screen
ReDim white As _Unsigned Long, hColr As _Unsigned Long
white = &HFFFFFFFF
s = 10 ' s is the unit for drawing and navigating screen each step is 2*s
t = .5 ' t is splitter between up/down walls and left/right walls
Color white
_Title "Press z increase over/under, x increase left/right, c makes smaller cells, v bigger, esc to quit, left mouse paints red/black, right blue/black, spacebar to reverse cells"
Do
    Cls
    xcells = Int(W / s) 'how many cells across
    ycells = Int(H / s) 'how many down
    ReDim maze(xcells + 2, ycells + 2) As Long ' save our wall settings in maze array for wall changing with spacebar
    For y = 0 To H Step s * 4
        For x = 0 To W Step s * 4
            r = Rnd
            'CIRCLE (x, y), 2, &HFFFFFF00
            If r <= t Then
                maze(Int(x / s), Int(y / s)) = -1
                Line (x - s, y + s)-(x + s, y + s) 'bottom line
                Line (x - s, y - s)-(x + s, y - s) 'top line
            End If
            If r > t Then
                maze(Int(x / s), Int(y / s)) = 1
                Line (x - s, y - s)-(x - s, y + s) 'left line
                Line (x + s, y - s)-(x + s, y + s) 'right line
            End If
            x = x + s * 2: y = y + s * 2 ' offset to do the other half of screen
            'CIRCLE (x, y), 2, &HFF0000FF
            r = Rnd
            If r <= t Then
                maze(Int(x / s), Int(y / s)) = -1
                Line (x - s, y + s)-(x + s, y + s) 'bottom line
                Line (x - s, y - s)-(x + s, y - s) 'top line
            End If
            If r > t Then
                maze(Int(x / s), Int(y / s)) = 1
                Line (x - s, y - s)-(x - s, y + s) 'left line
                Line (x + s, y - s)-(x + s, y + s) 'right line
            End If
            x = x - s * 2: y = y - s * 2 ' set back to first set
        Next
    Next
    If back Then _FreeImage back ' be careful not to cause a memory leak
    ReDim back As Long
    back = _NewImage(_Width, _Height, 32) ' this uses new memory regardless if back is same old name or not
    _PutImage , 0, back 'store current maze into image
    xcells = Int(W / s) 'how many cells across
    ycells = Int(H / s) 'how many down
    hx = Int(xcells / 2) 'put our guy smack in middle of screen but he has to be on even number of cells!
    If hx Mod 2 = 1 Then hx = hx + 1
    hy = Int(ycells / 2)
    If hy Mod 2 = 1 Then hy = hy + 1
    Do
        _PutImage , back, 0
        KH& = _KeyHit
        Select Case KH& '                                       which key was pressed?
            Case 27 '                                           the ESC key
                System '
            Case 32
                If maze(hx, hy) Then ' make sure on a cell that has walls
                    If maze(hx, hy) = 1 Then
                        maze(hx, hy) = -1
                    ElseIf maze(hx, hy) = -1 Then
                        maze(hx, hy) = 1
                    End If
                    ' now redraw everything!!!!
                    hColr = Point(hx * s - (s - 1), hy * s - (s - 1)) ' preserve color at hx, hy
                    Cls
                    For y = 0 To ycells Step 2 'redraw maze
                        For x = 0 To xcells Step 2
                            If maze(x, y) = -1 Then
                                Line (x * s - s, y * s + s)-(x * s + s, y * s + s) 'bottom line
                                Line (x * s - s, y * s - s)-(x * s + s, y * s - s) 'top line
                            ElseIf maze(x, y) = 1 Then
                                Line (x * s - s, y * s - s)-(x * s - s, y * s + s) 'left line
                                Line (x * s + s, y * s - s)-(x * s + s, y * s + s) 'right line
                            End If
                        Next
                    Next
                    If hColr <> white Then Paint (hx * s, hy * s), hColr, white ' paint the new roadway
                    'take a new picture
                    _Display
                    If back Then _FreeImage back ' be careful not to cause a memory leak
                    back = _NewImage(_Width, _Height, 32) ' this uses new memory regardless if back is same old name or not
                    _PutImage , 0, back 'store current maze into image
                Else
                    Sound 100, 4
                End If
            Case 18432 '  Up Arrow
                If hy - 2 > 0 Then
                    'CIRCLE (hx * s, (hy - 1) * s), 5, &HFFFFFF00
                    '_DELAY .5
                    'PRINT POINT(hx * s, (hy - 1) * s), POINT(hx * s, (hy - 1) * s + 1), POINT(hx * s, (hy - 1) * s - 1), white
                    '_DISPLAY
                    'SLEEP
                    If Point(hx * s, (hy - 1) * s) <> white And Point(hx * s, (hy - 1) * s + 1) <> white And Point(hx * s, (hy - 1) * s - 1) <> white Then hy = hy - 2
                End If
            Case 19712 'the RIGHT ARROW key
                If hx + 2 < xcells Then
                    'CIRCLE ((hx + 1) * s, hy * s), 5, &HFFFFFF00
                    '_DELAY .5
                    If Point((hx + 1) * s, hy * s) <> white And Point((hx + 1) * s + 1, hy * s) <> white And Point((hx + 1) * s - 1, hy * s) <> white Then hx = hx + 2
                End If
            Case 20480 ' the DOWN ARROW key
                If hy + 2 < ycells Then
                    'CIRCLE (hx * s, (hy + 1) * s), 5, &HFFFFFF00
                    '_DELAY .5
                    If Point(hx * s, (hy + 1) * s) <> white And Point(hx * s, (hy + 1) * s + 1) <> white And Point(hx * s, (hy + 1) * s - 1) <> white Then hy = hy + 2
                End If
            Case 19200 'the LEFT ARROW key
                If hx - 2 > 0 Then
                    'CIRCLE ((hx - 1) * s, hy * s), 5, &HFFFFFF00
                    '_DELAY .5
                    If Point((hx - 1) * s, hy * s) <> white And Point((hx - 1) * s + 1, hy * s) <> white And Point((hx - 1) * s - 1, hy * s) <> white Then hx = hx - 2
                End If
        End Select
        For ra = 0 To .5 * s Step .25 ' make a solid filled circle
            Circle (hx * s, hy * s), ra, &HFFFFFF00
        Next
        _Display
        _Limit 60

        ' the rest of this loop is input from user, the drawing part is over but might PAINT roadways

        While _MouseInput: Wend
        If _MouseButton(1) Then
            _Delay .2
            _PutImage , back, 0 'get rid of hero
            If Point(_MouseX, _MouseY) = _RGB32(0, 0, 0) Then
                Paint (_MouseX, _MouseY), _RGB32(255, 0, 0), &HFFFFFFFF
            ElseIf Point(_MouseX, _MouseY) = _RGB32(255, 0, 0) Then
                Paint (_MouseX, _MouseY), _RGB32(0, 0, 0), &HFFFFFFFF
            End If
            _Display
            If back Then _FreeImage back ' be careful not to cause a memory leak
            back = _NewImage(_Width, _Height, 32) ' this uses new memory regardless if back is same old name or not
            _PutImage , 0, back 'store current maze into image
        End If
        If _MouseButton(2) Then
            _Delay .2
            _PutImage , back, 0 'get rid of hero
            If Point(_MouseX, _MouseY) = _RGB32(0, 0, 255) Then
                Paint (_MouseX, _MouseY), _RGB32(0, 0, 0), &HFFFFFFFF
            ElseIf Point(_MouseX, _MouseY) = _RGB32(0, 0, 0) Then
                Paint (_MouseX, _MouseY), _RGB32(0, 0, 255), &HFFFFFFFF
            End If
            _Display
            If back Then _FreeImage back ' be careful not to cause a memory leak
            back = _NewImage(_Width, _Height, 32) ' this uses new memory regardless if back is same old name or not
            _PutImage , 0, back 'store current maze into image
        End If
        i$ = InKey$
        If i$ = "z" And t < 1 Then t = t + .05: Exit Do '  changed from .005 because too slow
        If i$ = "x" And t > 0 Then t = t - .05: Exit Do
        If i$ = "c" And s > 3 Then s = s - 1: Exit Do
        If i$ = "v" And s < 41 Then s = s + 1: Exit Do
        If i$ = Chr$(27) Then End
    Loop
Loop

I think that's the code I was remembering.
b = b + ...
Reply




Users browsing this thread: 1 Guest(s)