Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"5-line" engine
#21
(02-09-2024, 02:35 PM)GareBear Wrote: MadterGy, You put that the way I wanted to put it. Thank you!

SMcNeil, I am sorry to have offended you. It was not my intention to do any such thing. The difference between the two you did, James D Jarvis and the way you want to do is not much here in the sizes between them. 

Broke down into single command lines - 1.9k 1862 bytes - SMcNeill's
With colons - 1.0k or 1022 bytes - James D Jarvis'
1862 - 1022 = 840 bytes or 0.9k not much compression.

This prove MasterGy's program compression. Which GWBasic needed to run programs in which people then was trying to push the limits of the interpreter. Some like Jame D Jarvis like to have fun with the old way of using very little to no line numbers.

To all involved, Let us all try not take this too seriously and let others have flexibly in our creativity in the language we choose to use and learn from each other. - GareBear.

I'm not offended, and at the end of the day, everyone has to program in the style that suits them the best.  As long as the finished product works, then the program is a success.  Smile

That said, one thing you're not taking into account is that the vast majority of what I posted was nothing more than remarks to help highlight the changes I made.  If you remove those, you get something different:

Code: (Select All)
SCREEN _NEWIMAGE(80, 45, 0)
_FULLSCREEN
_CONTROLCHR OFF
RANDOMIZE TIMER
FOR d = 1 TO INT(200 + RND * (100 * (1 + RND * 4)))
    m$ = m$ + CHR$(49 + INT(RND * 4))
NEXT d
px = 40
py = 20
DO
    dx = 40
    dy = 20
    COLOR 7
    _PRINTSTRING (1, 1), STRING$(3280, 219)
    FOR c = 1 TO LEN(m$)
        _PRINTSTRING (dx, dy), "."
        SELECT CASE MID$(m$, c, 1)
            CASE "1": dy = dy - 1
            CASE "2": dx = dx + 1
            CASE "3": dy = dy + 1
            CASE "4": dx = dx - 1
        END SELECT
        IF dy = 40 OR dy = 1 OR dx = 80 OR dx = 1 THEN dy = 20: dx = 40
    NEXT c
    COLOR 15
    _PRINTSTRING (px, py), CHR$(2)
    kk$ = UCASE$(INPUT$(1))
    pxm = 0
    pym = 0
    SELECT CASE kk$
        CASE "W": pym = -1
        CASE "S": pym = 1
        CASE "D": pxm = 1
        CASE "A": pxm = -1
    END SELECT
    IF SCREEN(pym + py, pxm + px, 0) <> 219 THEN px = px + pxm: py = py + pym
LOOP UNTIL kk$ = CHR$(27)

983 bytes -- which is less than the original -- and it's still in a human-readable format.  Wink

The reason I was sharing what I did, was for the same purpose you stated:  "to use and learn from each other."

One way to think of this type project, is -- as you're doing yourself -- is to do a simple byte-count of a program.  And, oddly enough, colons *don't* reduce byte counts or file size -- in fact, they *increase* it!

Take these two lines for instance:

PRINT: PRINT

vs

PRINT
PRINT

Which is longer and uses more bytes to store that program?

The first is "print: print", for a total of 12-bytes.

The second is "printCRLFprint", which on Windows CRLF is going to be chr$(10) + chr$(13) for a total of 12-bytes, but on Linux and Mac, it's *just* going to chr$(10), which makes the length 11-bytes.

At best, colon + space breaks even on disk size -- and that's only possible where you're using Windows which has a 2-byte CRLF system.  Otherwise, it's just going to make your code LONGER than before; not shorter.

A second thing to note -- I kept the spacing and formatting going with what I shared, just like with the comments.  Take those out and you end up with this:

Code: (Select All)
SCREEN _NEWIMAGE(80, 45, 0)
_FULLSCREEN
_CONTROLCHR OFF
RANDOMIZE TIMER
FOR d = 1 TO INT(200 + RND * (100 * (1 + RND * 4)))
m$ = m$ + CHR$(49 + INT(RND * 4))
NEXT d
px = 40
py = 20
DO
dx = 40
dy = 20
COLOR 7
_PRINTSTRING (1, 1), STRING$(3280, 219)
FOR c = 1 TO LEN(m$)
_PRINTSTRING (dx, dy), "."
SELECT CASE MID$(m$, c, 1)
CASE "1": dy = dy - 1
CASE "2": dx = dx + 1
CASE "3": dy = dy + 1
CASE "4": dx = dx - 1
END SELECT
IF dy = 40 OR dy = 1 OR dx = 80 OR dx = 1 THEN dy = 20: dx = 40
NEXT c
COLOR 15
_PRINTSTRING (px, py), CHR$(2)
kk$ = UCASE$(INPUT$(1))
pxm = 0
pym = 0
SELECT CASE kk$
CASE "W": pym = -1
CASE "S": pym = 1
CASE "D": pxm = 1
CASE "A": pxm = -1
END SELECT
IF SCREEN(pym + py, pxm + px, 0) <> 219 THEN px = px + pxm: py = py + pym
LOOP UNTIL kk$ = CHR$(27)

811 bytes for the same program.

Packing multiple lines together doesn't make the end code any shorter.  It just makes it harder to read and edit.  It's this old-style of thinking which lead to BASIC getting such a bad reputation all those years ago, and it being dropped by Microsoft. 

I'm not trying to pick on James or anything, and I hope he doesn't take it that way.  I was just hoping to help highlight and show that there's really no reason to pack your lines together in such a manner.  You're not really making a shorter program, or one that uses less memory to load or run.  All you're doing is creating a program which is harder to read, understand, and maintain.

Wink
Reply
#22
Thanks SMcNeill!

I wasn't arguing against what you liked. Code need to be understood by the author as well others. We all avoid to comments our intentions in each part of the code thinking we will not forget what we did. Some people likes to be on the off beaten paths. I was trying explain what I had heard in the past and why it still needed in some small part. You may know this better than I do. The IDE-compiler is not the interpreter we had back then. That I am glad it is better than in the past. You and your usual contributors made it better than before and still the same. Thanks again! - GareBear.
Reply
#23
I thought it was break even in byte counts between colon files and decolon files and unpacked MasterGy's nice little game made from Game Engine oh surprise! 400 bytes less with colons than without.

With more lines you have more CRLF's so for every colon you save CRLF's from line count
so you break even colon + Space = CRLF but with colons you have that much less lines.

So line counts 11+ versus 98 + = 87 whoa! but I got 400 byte difference guess where all the extra bytes were?

Here is the breakdown for asci chars of significance:
   
b = b + ...
Reply
#24
(02-09-2024, 08:42 PM)bplus Wrote: I thought it was break even in byte counts between colon files and decolon files and unpacked MasterGy's nice little game made from Game Engine oh surprise! 400 bytes less with colons than without.

With more lines you have more CRLF's so for every colon you save CRLF's from line count
so you break even colon + Space = CRLF but with colons you have that much less lines.

So line counts 11+ versus 98 +  = 87 whoa! but I got 400 byte difference guess where all the extra bytes were?

Here is the breakdown for asci chars of significance:
I didn't know how to record it in text format (bas).

I played with the code a bit more.
-moving no wasd, moving ARROWS
-I replaced inkey with _keydown, so the movement of the puppet is smooth
-3 enemies with different identities. walks around the wall, moves horizontally/vertically, moves diagonally
(the structure of the 3 different moves compressed into 1 processing part)

the length of the code did not become longer, because there was something else I could take.
I kept to the original goal. If you want, you can put it all in 1 line, there is no IF.

Code: (Select All)
en = 6: gold = 12: c0 = 219: c1 = 46: c2 = 36: c3 = 35: c4 = 2: r(0) = 80: r(1) = 40 'en=enemies gold=golds 'c0,c1,c2,c3,c4 wall,street,gold,enemi,iam - ascii code of characters in order r(0)r(1)=map size

For t = 0 To 1: r(2 + t) = Int(r(t) / 2): p(t) = r(2 + t): d(t) = p(t): Next t

Randomize Timer: Screen _NewImage(r(0), r(1), 0): _FullScreen: _ControlChr Off

'make map
Color 6: _PrintString (1, 1), String$(r(0) * r(1), Chr$(c0))
For c = 1 To 4000: _PrintString (d(0), d(1)), Chr$(c1)
    t = Int(4 * Rnd)
    f = 0
    For a = 0 To 1
        b = a * 2
        l = t = b + 1
        d(a) = (t = b Or l) * (l * 2 + 1) + d(a)
        f = f Or d(a) = 1 Or d(a) = r(a) - 1
    Next a

    For t = 0 To 1
        d(t) = r(t + 2) * -f + d(t) * (-f Xor 1)
Next t, c

'make golds
Color 14
For c = 1 To gold
    Do
        For t = 0 To 1: g(t) = Int((r(t) - 10) * Rnd) + 5: Next t
    Loop While Screen(g(1), g(0), 0) <> c1 Or g(0) = r(2)
    _PrintString (g(0), g(1)), Chr$(c2)
Next c

'make enemies
For c = 0 To en - 1
    Do
        For t = 0 To 1
            en(c, t) = Int((r(t) - 10) * Rnd) + 5
        Next t
    Loop Until Screen(en(c, 1), en(c, 0), 0) = c1 And Screen(en(c, 1), en(c, 0) + 1, 0) = c0
Next c


'GAME cycle
Do
    Color 6: _PrintString (p(0), p(1)), Mid$(Chr$(c1), 1, c)
    m(0) = p(0): m(1) = p(1)

    'control me
    For t = 0 To 3
        e = ((t And 1) * 2 - 1) * _KeyDown(Val(Mid$("19712192002048018432", t * 5 + 1, 5)))
        q = Sgn(t And 2)
        m(q) = e + m(q)
        m = m Or e
    Next t
    c = Abs(m And Screen(m(1), m(0), 0) <> c0)

    For t = 0 To 1
        p(t) = m(t) * c + p(t) * (c Xor 1)
    Next t

    fg = -(Screen(p(1), p(0), 0) = c2)
    mygold = mygold + fg
    Sound 2000, .6 * fg

    Color 15: _PrintString (p(0), p(1)), Chr$(c4): m = 0

    'control enemies
    For c = 0 To en - 1

        die = die Or Screen(en(c, 1), en(c, 0), 0) = c4
        ti = c Mod 3 'which personality enemie
        t = en(c, 2) - (ti = 0) * 2
        Do
            t = t + (ti = 0)
            For w = 0 To 1
                b = (t + 16 + w) Mod 4
                d(w) = en(c, w) + (((b And 1) = 0) * ((b = 0) * 2 + 1)) * (ti <> 1) - (Sgn(t And (1 + w)) * 2 - 1) * (ti = 1)
            Next w
            u = Screen(d(1), d(0), 0)
            z = -(u = c0)
            t = (t - Int(4 * Rnd) * (z And (ti > 0))) Mod 4
        Loop While z

        Color 6
        _PrintString (en(c, 0), en(c, 1)), Mid$(Chr$(c1), 1, en(c, 3))
        en(c, 0) = d(0)
        en(c, 1) = d(1)
        en(c, 2) = t
        en(c, 3) = -(u = c1)
        Color 2: _PrintString (d(0), d(1)), Mid$(Chr$(c3), 1, en(c, 3))
        die = die Or (u = c4) Or (m(0) = en(c, 0) And m(1) = en(c, 1))
    Next c

    Do Until Len(InKey$) Or st
        _PrintString (1, 1), "Press a key to start"
    Loop: st = 1

    Color 6: _PrintString (1, 1), String$(50, Chr$(c0))

    _Limit 10

Loop Until _KeyDown(27) Or gold = mygold Or die
Color 15: Print Left$("you dead", -8 * die); Left$("congratulation!", -15 * (gold = mygold))
Reply
#25
Big GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig Grin

Code: (Select All)
en = 6: gold = 12: c0 = 219: c1 = 46: c2 = 36: c3 = 35: c4 = 2: r(0) = 80: r(1) = 40: For t = 0 To 1: r(2 + t) = Int(r(t) / 2): p(t) = r(2 + t): d(t) = p(t): Next t: Randomize Timer: Screen _NewImage(r(0), r(1), 0): _FullScreen
_ControlChr Off: Color 6: _PrintString (1, 1), String$(r(0) * r(1), Chr$(c0)): For c = 1 To 4000: _PrintString (d(0), d(1)), Chr$(c1): t = Int(4 * Rnd): f = 0: For a = 0 To 1: b = a * 2: l = t = b + 1
    d(a) = (t = b Or l) * (l * 2 + 1) + d(a): f = f Or d(a) = 1 Or d(a) = r(a) - 1: Next a: For t = 0 To 1: d(t) = r(t + 2) * -f + d(t) * (-f Xor 1): Next t, c: Color 14: For c = 1 To gold: Do: For t = 0 To 1
        g(t) = Int((r(t) - 10) * Rnd) + 5: Next t: Loop While Screen(g(1), g(0), 0) <> c1 Or g(0) = r(2): _PrintString (g(0), g(1)), Chr$(c2): Next c: For c = 0 To en - 1: Do: For t = 0 To 1: en(c, t) = Int((r(t) - 10) * Rnd) + 5
        Next t: Loop Until Screen(en(c, 1), en(c, 0), 0) = c1 And Screen(en(c, 1), en(c, 0) + 1, 0) = c0: Next c: Do: Color 6: _PrintString (p(0), p(1)), Mid$(Chr$(c1), 1, c): m(0) = p(0): m(1) = p(1): For t = 0 To 3
        e = ((t And 1) * 2 - 1) * _KeyDown(Val(Mid$("19712192002048018432", t * 5 + 1, 5))): q = Sgn(t And 2): m(q) = e + m(q): m = m Or e: Next t: c = Abs(m And Screen(m(1), m(0), 0) <> c0): For t = 0 To 1
        p(t) = m(t) * c + p(t) * (c Xor 1): Next t: fg = -(Screen(p(1), p(0), 0) = c2): mygold = mygold + fg: Sound 2000, .6 * fg: Color 15: _PrintString (p(0), p(1)), Chr$(c4): m = 0: For c = 0 To en - 1
        die = die Or Screen(en(c, 1), en(c, 0), 0) = c4: ti = c Mod 3: t = en(c, 2) - (ti = 0) * 2: Do: t = t + (ti = 0): For w = 0 To 1: b = (t + 16 + w) Mod 4
            d(w) = en(c, w) + (((b And 1) = 0) * ((b = 0) * 2 + 1)) * (ti <> 1) - (Sgn(t And (1 + w)) * 2 - 1) * (ti = 1): Next w: u = Screen(d(1), d(0), 0): z = -(u = c0): t = (t - Int(4 * Rnd) * (z And (ti > 0))) Mod 4
        Loop While z: Color 6: _PrintString (en(c, 0), en(c, 1)), Mid$(Chr$(c1), 1, en(c, 3)): en(c, 0) = d(0): en(c, 1) = d(1): en(c, 2) = t: en(c, 3) = -(u = c1): Color 2: _PrintString (d(0), d(1)), Mid$(Chr$(c3), 1, en(c, 3))
    die = die Or (u = c4) Or (m(0) = en(c, 0) And m(1) = en(c, 1)): Next c: Do Until Len(InKey$) Or st: _PrintString (1, 1), "Press a key to start": Loop: st = 1: Color 6: _PrintString (1, 1), String$(50, Chr$(c0))
_Limit 10: Loop Until _KeyDown(27) Or gold = mygold Or die: Color 15: Print Left$("you dead", -8 * die); Left$("congratulation!", -15 * (gold = mygold))
Reply
#26
@bplus The CRLF is 1 or 2 bytes depending on OS.  Colon separated is usually colon + space, which is 2 bytes.  At best, you break even.  At worst, you add a byte each time.

Your difference is probably leading whitespace.  QB64 saves your file with those leading spaces so it looks all nice and indented if you open in another text editor.

LTRIM$ those lines before saving and see how it compares for you. Wink
Reply
#27
Mouse control ! The puppet moves in the direction of the mouse cursor!
Even less lines!!!!

Code: (Select All)
en = 9: gold = 12: c0 = 219: c1 = 46: c2 = 36: c3 = 35: c4 = 2: r(0) = 80: r(1) = 45: For t = 0 To 1: r(2 + t) = Int(r(t) / 2): p(t) = r(2 + t): d(t) = p(t): Next t: Randomize Timer: Screen _NewImage(r(0), r(1), 0): _FullScreen
_ControlChr Off: Color 6: _PrintString (1, 1), String$(r(0) * r(1), Chr$(c0)): For c = 1 To 4000: _PrintString (d(0), d(1)), Chr$(c1): t = Int(4 * Rnd): f = 0: For a = 0 To 1: b = a * 2: l = t = b + 1
    d(a) = (t = b Or l) * (l * 2 + 1) + d(a): f = f Or d(a) = 1 Or d(a) = r(a) - 1: Next a: For t = 0 To 1: d(t) = r(t + 2) * -f + d(t) * (-f Xor 1): Next t, c: Color 14: For c = 1 To gold: Do: For t = 0 To 1
        g(t) = Int((r(t) - 10) * Rnd) + 5: Next t: Loop While Screen(g(1), g(0), 0) <> c1 Or g(0) = r(2): _PrintString (g(0), g(1)), Chr$(c2): Next c: For c = 0 To en - 1: Do: For t = 0 To 1: en(c, t) = Int((r(t) - 10) * Rnd) + 5
    Next t: Loop Until Screen(en(c, 1), en(c, 0), 0) = c1 And Screen(en(c, 1), en(c, 0) + 1, 0) = c0: Next c: Do: Color 6: _PrintString (p(0), p(1)), Mid$(Chr$(c1), 1, c): While _MouseInput: Wend
    die = die Or Screen(p(1), p(0), 0) = c3: d1 = Sgn(_MouseX - p(0)): d2 = Sgn(_MouseY - p(1)): m(0) = d1 + p(0): m(1) = d2 + p(1): m = Abs(d1 Or d2) * st: c = Abs(m And Screen(m(1), m(0), 0) <> c0): For t = 0 To 1
    p(t) = m(t) * c + p(t) * (c Xor 1): Next t: fg = -(Screen(p(1), p(0), 0) = c2): mygold = mygold + fg: Sound 2000, .6 * fg: die = die Or Screen(p(1), p(0), 0) = c3: Color 15: _PrintString (p(0), p(1)), Chr$(c4): m = 0
    For c = 0 To en - 1: die = die Or Screen(en(c, 1), en(c, 0), 0) = c4: ti = c Mod 3: t = en(c, 2) - (ti = 0) * 2: Do: t = t + (ti = 0): For w = 0 To 1: b = (t + 16 + w) Mod 4
        d(w) = en(c, w) + (((b And 1) = 0) * ((b = 0) * 2 + 1)) * (ti <> 1) - (Sgn(t And (1 + w)) * 2 - 1) * (ti = 1): Next w: u = Screen(d(1), d(0), 0): z = -(u = c0): t = (t - Int(4 * Rnd) * (z And (ti > 0))) Mod 4: Loop While z
        Color 6: _PrintString (en(c, 0), en(c, 1)), Mid$(Chr$(c1), 1, en(c, 3)): en(c, 0) = d(0): en(c, 1) = d(1): en(c, 2) = t: en(c, 3) = -(u = c1): Color 2: _PrintString (d(0), d(1)), Mid$(Chr$(c3), 1, en(c, 3))
    die = die Or (u = c4) Or (m(0) = en(c, 0) And m(1) = en(c, 1)): Next c: Do Until _MouseButton(1) Or st: _PrintString (1, 1), "Press left mouse button to start": t = _MouseInput: Loop: st = 1: Color 6
_PrintString (1, 1), String$(50, Chr$(c0)): _Limit 10: Loop Until _KeyDown(27) Or gold = mygold Or die: Color 15: Print Left$("you dead", -8 * die); Left$("congratulation!", -15 * (gold = mygold))
Reply
#28
@MasterGy definitely better with mouse! less bytes same amount of lines. Save more, use screen 0, 2 colors fore and back only, normal print chars, and 1 letter variable names. Big Grin Big Grin Big Grin Big Grin
b = b + ...
Reply
#29
(02-09-2024, 03:23 PM)SMcNeill Wrote: Packing multiple lines together doesn't make the end code any shorter.  It just makes it harder to read and edit.  It's this old-style of thinking which lead to BASIC getting such a bad reputation all those years ago, and it being dropped by Microsoft. 

Sadly this is true... To that point, when I first started with QB64, one of the first programs I ran was the GWBASIC port of Akalabeth (the precursor to Ultima, the RPG). I wanted to mod the game to use tile graphics like the later games... easier said than done! Talk about spaghetti code! Multiple statements crammed on the same line everywhere, cryptic variable names, and line numbers galore. And since this was done before BASIC got nice structural programming features, no indentation! No wonder BASIC got such a bad rap, and it's too bad!
Reply
#30
I added a convenience function. If there is a wall between the mouse cursor and the puppet, the puppet cannot go to the desired location. In the innovation, I used the 'Dijkstra' algorithm to find the way between the puppet and the mouse cursor, so he finds the way.
It is no longer good for the challenge, because it has been extended by a few lines, so I will stop it.
It's more of a curiosity.

Code: (Select All)
en = 9: gold = 12: c0 = 219: c1 = 46: c2 = 36: c3 = 35: c4 = 2: r(0) = 80: r(1) = 45: For t = 0 To 1: r(2 + t) = Int(r(t) / 2): p(t) = r(2 + t): d(t) = p(t): Next t: Randomize Timer: Screen _NewImage(r(0), r(1), 0): _FullScreen
_ControlChr Off: Color 6: _PrintString (1, 1), String$(r(0) * r(1), Chr$(c0)): For c = 1 To 4000: _PrintString (d(0), d(1)), Chr$(c1): t = Int(4 * Rnd): f = 0: For a = 0 To 1: b = a * 2: l = t = b + 1
    d(a) = (t = b Or l) * (l * 2 + 1) + d(a): f = f Or d(a) = 1 Or d(a) = r(a) - 1: Next a: For t = 0 To 1: d(t) = r(t + 2) * -f + d(t) * (-f Xor 1): Next t, c: Color 14: For c = 1 To gold: Do: For t = 0 To 1
        g(t) = Int((r(t) - 10) * Rnd) + 5: Next t: Loop While Screen(g(1), g(0), 0) <> c1 Or g(0) = r(2): _PrintString (g(0), g(1)), Chr$(c2): Next c: For c = 0 To en - 1: Do: For t = 0 To 1: en(c, t) = Int((r(t) - 10) * Rnd) + 5
    Next t: Loop Until Screen(en(c, 1), en(c, 0), 0) = c1 And Screen(en(c, 1), en(c, 0) + 1, 0) = c0: Next c: Do: Color 6: _PrintString (p(0), p(1)), Mid$(Chr$(c1), 1, c): die = die Or Screen(p(1), p(0), 0) = c3
    ReDim di(r(0) - 1, r(1) - 1) As _Byte: For x = 1 To r(0) - 2: For y = 1 To r(1) - 2: di(x, y) = Screen(y, x, 0) = c0: Next y, x: While _MouseInput: Wend: e = 0: k = 1: di(_MouseX, _MouseY) = k: j = 15: Do Until e Or k > j
        mdis = 100: For x1 = -1 To 1: For y1 = -1 To 1: x2 = p(0) + x1: y2 = p(1) + y1: dis = Abs(x2 - _MouseX) + Abs(y2 - _MouseY): n = ((di(p(0) + x1, p(1)) = -1) And (di(p(0), p(1) + y1) = -1) And x1 And y1) = 0
            q = Abs(di(x2, y2) = k And dis < mdis And n): e = e Or q: d1 = d1 * (q Xor 1) + x1 * q: d2 = d2 * (q Xor 1) + y1 * q: mdis = mdis * (q Xor 1) + dis * q: Next y1, x1: For x = 1 To r(0) - 2: For y = 1 To r(1) - 2: f = 0
                For x1 = -1 To 1: For y1 = -1 To 1: n = ((di(x + x1, y) = -1) And (di(x, y + y1) = -1) And x1 And y1) = 0: f = f Or ((di(x + x1, y + y1) = k) And (x1 Or y1) And n): Next y1, x1: f = Abs(f And di(x, y) = 0)
        di(x, y) = (k + 1) * f + di(x, y) * (f Xor 1): Next y, x: k = k + 1: Loop: m(0) = d1 + p(0): m(1) = d2 + p(1): m = Abs(d1 Or d2) * st: c = Abs(m And Screen(m(1), m(0), 0) <> c0): For t = 0 To 1: p(t) = m(t) * c + p(t) * (c Xor 1)
    Next t: fg = -(Screen(p(1), p(0), 0) = c2): mygold = mygold + fg: Sound 2000, .6 * fg: die = die Or Screen(p(1), p(0), 0) = c3: Color 15: _PrintString (p(0), p(1)), Left$(Chr$(c4), 1 + (k > j) * j3): j3 = j3 Xor 1: m = 0
    For c = 0 To en - 1: die = die Or Screen(en(c, 1), en(c, 0), 0) = c4: ti = c Mod 3: t = en(c, 2) - (ti = 0) * 2: Do: t = t + (ti = 0): For w = 0 To 1: b = (t + 16 + w) Mod 4
        d(w) = en(c, w) + (((b And 1) = 0) * ((b = 0) * 2 + 1)) * (ti <> 1) - (Sgn(t And (1 + w)) * 2 - 1) * (ti = 1): Next w: u = Screen(d(1), d(0), 0): z = -(u = c0): t = (t - Int(4 * Rnd) * (z And (ti > 0))) Mod 4: Loop While z
        Color 6: _PrintString (en(c, 0), en(c, 1)), Mid$(Chr$(c1), 1, en(c, 3)): en(c, 0) = d(0): en(c, 1) = d(1): en(c, 2) = t: en(c, 3) = -(u = c1): Color 2: _PrintString (d(0), d(1)), Mid$(Chr$(c3), 1, en(c, 3))
    die = die Or (u = c4) Or (m(0) = en(c, 0) And m(1) = en(c, 1)): Next c: Do Until _MouseButton(1) Or st: _PrintString (1, 1), "Press left mouse button to start": t = _MouseInput: Loop: st = 1: Color 6
_PrintString (1, 1), String$(50, Chr$(c0)): _Limit 8: _Display: Loop Until _KeyDown(27) Or gold = mygold Or die: Color 15: Print Left$("you dead", -8 * die); Left$("congratulation!", -15 * (gold = mygold))
Reply




Users browsing this thread: 1 Guest(s)