Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 496
» Latest member: braveparrot
» Forum threads: 2,845
» Forum posts: 26,661

Full Statistics

Latest Threads
Big problem for me.
Forum: General Discussion
Last Post: JRace
42 minutes ago
» Replies: 11
» Views: 161
Virtual Arrays
Forum: Site Suggestions
Last Post: hsiangch_ong
5 hours ago
» Replies: 8
» Views: 292
QBJS v0.9.0 - Release
Forum: QBJS, BAM, and Other BASICs
Last Post: hsiangch_ong
5 hours ago
» Replies: 17
» Views: 282
QBJS - ASCII Draw
Forum: QBJS, BAM, and Other BASICs
Last Post: hsiangch_ong
5 hours ago
» Replies: 1
» Views: 32
Very basic key mapping de...
Forum: SMcNeill
Last Post: SMcNeill
6 hours ago
» Replies: 0
» Views: 20
Cautionary tale of open, ...
Forum: General Discussion
Last Post: mdijkens
8 hours ago
» Replies: 2
» Views: 60
Fun with Ray Casting
Forum: a740g
Last Post: Petr
9 hours ago
» Replies: 5
» Views: 89
1990's 3D Doom-Like Walls...
Forum: Programs
Last Post: a740g
11 hours ago
» Replies: 10
» Views: 307
Editor WIP
Forum: bplus
Last Post: aadityap0901
Yesterday, 08:54 AM
» Replies: 12
» Views: 680
discover graphics with xa...
Forum: Programs
Last Post: hsiangch_ong
01-14-2025, 10:39 PM
» Replies: 0
» Views: 34

 
  BAM "dev" and "prod" directives
Posted by: CharlieJV - 11-21-2022, 11:48 PM - Forum: QBJS, BAM, and Other BASICs - Replies (8)

A program can be at one of two promotion levels: development or production.

When at the development level, there are two versions of the program available: development and production.

When at the production level, there is only the one version of the program: production.  Until edited, at which point it is back at the development level.

That aside:

We may want a program to look/behave differently depending on what version we are running/exporting.
This is where the "dev" and "prod" preprocessor directives come in.

Sample code:



Code: (Select All)
<<dev """
greet$ = "howdy buds, this is the development version of the program"
""">>

<<prod """
greet$ = "good day ladies and gentlement, this is the production version of the program"
""">>

print greet$

In the sample code above, greet$ will have one value when we are running the development version, and a different value when running the production version.

Print this item

  DAY 016: _MOUSEINPUT
Posted by: SMcNeill - 11-21-2022, 11:27 PM - Forum: Keyword of the Day! - Replies (25)

Today's Keyword of the Day is the first which has poor Steve shaking his head and sighing deeply over our documentation and wiki entries on it.  Guys, do me a favor and toss the wiki examples out of your brains, as they're NOT what you want to do with _MOUSEINPUT at all.  



Let me illustrate with the first example from the wiki:



Code: (Select All)
DO
  DO WHILE _MOUSEINPUT '      Check the mouse status
    PRINT _MOUSEX, _MOUSEY, _MOUSEBUTTON(1), _MOUSEWHEEL
  LOOP
LOOP UNTIL INKEY$ <> ""


Seems to work as advertised, so what's the problem here?



Nothing should go inside your _MOUSEINPUT loop, except for a _MOUSEWHEEL counter!



Let me show you why:



Code: (Select All)
Do
    Locate 1
    i = 1
    Do While _MouseInput '      Check the mouse status
        Locate i, 1: Print _MouseX, _MouseY, _MouseButton(1), _MouseWheel
        i = i + 1
    Loop
    If i <> 1 Then For z = i To 20: Locate z, 1: Print Space$(60): Next
    Locate 21, 1: Print _MouseX, _MouseY, _MouseButton(1)
    _Limit 120
Loop Until InKey$ <> ""




Take the first code and imagine trying to actually do something with it.  Printing it inside that example loop isn't actually doing anything constructive for us -- it's just displaying all the mouse's minute movements as it crosses the screen.  If we're going to check the mouse against a button, or some such, that we've draw upon our screen, we'll need to settle on o single value for that mouse position which we compare against -- and that's going to be AFTER WE EXIT THE LOOP.

Code: (Select All)
Do While _MOUSEINPUT
Loop


^The above says we're not going to actually do anything with our _MOUSEX and _MOUSEY values...  We'll only respond to them outside the loop.



And, as you can see from my second set of code, the end result is *always* going to print the same values as the last pass inside the loop did...



So why would we waste time processing a couple of dozen events, assigning them to overwrite the same values over and over and whatnot, when we're just going to toss those values out the door at the end of the loop??



IF both sets of the following code produce the same results, which is more efficient for us?



Code: (Select All)
While _MouseInput
    x = _MOUSEX:  y = _MOUSEY
Wend


Code: (Select All)
While _MouseInput; Wend
x = _MouseX: y = _MouseY


Both are going to generate the exact same values for x and y, so which is more efficient for us?  The first code is going to assign several dozen temporary values to x and y, before exiting and giving us a final value for x and y.  The second code skips all that intermittent assignment and just gives us the final result after the mouseinput loop.






Our second example in the wiki is just as poorly written, and is just as bad of an example.



Code: (Select All)
SCREEN 12

DO ' main program loop

  ' your program code

  DO WHILE _MOUSEINPUT'mouse status changes only
    x = _MOUSEX
    y = _MOUSEY
    IF x > 0 AND x < 640 AND y > 0 AND y < 480 THEN
      IF _MOUSEBUTTON(2) THEN
        PSET (x, y), 15
        LOCATE 1, 1: PRINT x, y
      END IF
    END IF
  LOOP

  ' your program code

LOOP UNTIL INKEY$ = CHR$(27)



Once again, the example is processing all sorts of crap inside that _MOUSEINPUT loop that it doesn't need to.  Compile it.  Run it.  Watch how it behaves.   And then compare to the following:



Code: (Select All)
Screen 12

Do ' main program loop

    ' your program code

    Do While _MouseInput: Loop 'mouse status changes only

    ' your program code
    x = _MouseX
    y = _MouseY
    If x > 0 And x < 640 And y > 0 And y < 480 Then
        If _MouseButton(2) Then
            PSet (x, y), 15
            Locate 1, 1: Print x, y
        End If
    End If

Loop Until InKey$ = Chr$(27)




The only thing that needs to go inside a _MOUSEINPUT loop is possibly a counter to deal with _MOUSEWHEEL.  Everything else should go outside it, or else you're going to end up lagging up your program to the point of uselessness.



MouseInput code should generally look like one of the two varieties below:



Code: (Select All)
While _MouseInput: Wend


Code: (Select All)
While _MouseInput
    scrollwheel = scrollwheel + _MOUSEWHEEL
Wend


Attempting to process other code inside that mouseinput loop is just asking for trouble.  Our wiki examples work for what they're showing, but what they're showing is about the worst possible structure I could imagine for use with _MOUSEINPUT.  Honestly, they must've just written into the wiki when _MOUSEINPUT was first added into the wiki and nobody knew much about it..  As it stands now, those examples need an overhaul to show how to actually use them properlyWink

Print this item

  QBJS v0.6.1 Release
Posted by: dbox - 11-21-2022, 07:30 PM - Forum: QBJS, BAM, and Other BASICs - Replies (5)

Hi All,

Just published a small update to the last release of QBJS.  I've added a screen pixel cache to improve the performance of programs that heavily utilize PSET for rendering.

For example, @vince's American flag now majestically waves at a more acceptable rate.  Not quite as fast as native QB64 on my box, but a lot closer than before.

Also, there have been a number of posts recently of "Bubble Universes" which also run a lot faster:

Bubble Universe
Bubble Universe 2
Bubble Universe 3

There is also a rotating planet example that @bplus found in another thread that didn't run very smoothly before that works better now.

Note:  If you are not seeing an improvement when you try these examples, you might need to do a SHIFT+Refresh to clear the cached version in your browser.

Print this item

  USB Camera?
Posted by: james2464 - 11-21-2022, 07:12 PM - Forum: Help Me! - Replies (15)

I don't know much about this topic of accessing PC/Mac/Linux devices.

Is it possible to capture a still image from a USB camera from within a QB64 program?   Or would this be incredibly complicated?   Obviously the easiest thing to do is just manually capture the image (using the camera software) then _loadimage into QB64.  

I'm wondering if QB64 could be used to capture a new image at a certain time interval and discard the previous image.

Print this item

  Multilanguage Support.
Posted by: gaslouk - 11-21-2022, 01:24 PM - Forum: General Discussion - Replies (5)

I would like to ask a question to the community here.
How easy is it for QB64 to support the Greek language?
That is, what is written in quotation marks.
For example,

PRINT "Den ypostirizo ellinikoys xaraktires>"
PRINT "I do not support Greek characters."
PRINT "Δεν υποστηρίζω ελληνικούς χαρακτηρισμούς."
SLEEP

Copy this little example and you'll see exactly what I mean.
I would like one day to be able to make my own programs and insert Greek characters where needed.

Thank you very much for your valuable time.

Postscript. I hope I wrote it in the right place.
[Image: 118.png]

Print this item

  Mini-Robo-Mixer
Posted by: James D Jarvis - 11-21-2022, 07:53 AM - Forum: Programs - Replies (18)

Mini-Robo-Mixer generates a sprite sheet of robots.

Code: (Select All)
'Mini-Robo-Mixer v0.1
'By James D. Jarvis November 2022
'This program uses BASIMAGE coded by Dav for QB64GL 1.4, MAY/2020
'
'generate a sprite sheet of monsters
'each is 64 by 64 pixels but code here can be modified to change that
'
'press c or s to save a sprite sheet to the clipboard so you can paste it into a paint program
'and save is whatever format you desire
'pres <esc> to quit
'
'License: Share sprite sheets as long as they include generated credit bar in image
'any programs using original code or graphics from source or generated by program
' please include the following (or equivalent) line somwhere in comments and documentation:
'Includes Art and/or Code from Mini-Robo-Mixer v0.1 created by James D. Jarvis
'
Randomize Timer
Dim Shared ms&
ms& = _NewImage(512, 360, 32)
Screen ms&
_Title "Mini-Robo-Mixer V0.1"
Dim Shared part&
Dim Shared kk1 As _Unsigned Long
Dim Shared kk2 As _Unsigned Long
Dim Shared kk3 As _Unsigned Long
Dim Shared kk4 As _Unsigned Long
Dim Shared kk5 As _Unsigned Long
Dim Shared kk6 As _Unsigned Long

Dim Shared clr~&
part& = BASIMAGE1&

Type robobody_type
    head As Integer
    larm As Integer
    rarm As Integer
    torso As Integer
    leg As Integer
    k1 As _Unsigned Long
    k2 As _Unsigned Long
    k3 As _Unsigned Long
    k4 As _Unsigned Long
    k5 As _Unsigned Long
    k6 As _Unsigned Long
    xsiz As Integer
    ysiz As Integer
End Type
robot_limit = 40
Dim klrset(12, 3) As Integer
Dim Shared rlook(robot_limit) As robobody_type
_Source part&
'read the colors from the color reference bar whichever color is in the top left corner will be transparent
clr~& = Point(0, 0) 'find background color of image
kk1 = Point(0, 1): kk2 = Point(0, 2): kk3 = Point(0, 3): kk4 = Point(0, 4): kk5 = Point(0, 5): kk6 = Point(0, 6)
_Dest part&
Line (0, 0)-(0, 8), clr~& 'erase the color reference bar from the bit map
_ClearColor clr~&, ms& 'set background color as transparent
_ClearColor clr~&, part&
_Source ms&
_Dest ms&
Do
    Cls
    'build a color set for the sprite sheet
    For k = 1 To 12
        klrset(k, 1) = Int(Rnd * 100 + 150)
        If Rnd * 7 < 3 Then klrset(k, 2) = klrset(k, 1) Else klrset(k, 2) = Int(Rnd * 100 + 150)
        If Rnd * 7 < 3 Then klrset(k, 3) = klrset(k, 1) Else klrset(k, 3) = Int(Rnd * 100 + 150)
    Next k
    mmx = 0: mmy = 0
    For m = 1 To robot_limit
        'create a new set of monster sprites
        'included image source has 16 options for head,arms,torso, and legs
        rlook(m).head = Int(1 + Rnd * 20)
        rlook(m).larm = Int(1 + Rnd * 20)
        If Rnd * 10 < 3 Then rlook(m).rarm = rlook(m).larm Else rlook(m).rarm = Int(1 + Rnd * 20)
        rlook(m).torso = Int(1 + Rnd * 20)
        rlook(m).leg = Int(1 + Rnd * 20)
        'determing colors for this specific monster sprite
        kp = 1 + Int(Rnd * 12)
        kr = klrset(kp, 1): kg = klrset(kp, 2): kb = klrset(kp, 3)
        kr2 = Int(kr / 2): kg2 = Int(kg / 2): kb2 = Int(kb / 2)
        kp = 1 + Int(Rnd * 6)
        kr3 = klrset(kp, 1) - 5: kg3 = klrset(kp, 2) - 10: kb3 = klrset(kp, 3) - 15
        kr4 = Int(kr3 / 2): kg4 = Int(kg3 / 2): kb4 = Int(kb3 / 2)
        kp = 1 + Int(Rnd * 6)
        kr5 = klrset(kp, 1) - 20: kg5 = klrset(kp, 2) - 15: kb5 = klrset(kp, 3) - 7
        kr6 = Int(kr5 / 2): kg6 = Int(kg5 / 2): kb6 = Int(kb5 / 2)


        rlook(m).k1 = _RGB32(kr, kg, kb)
        rlook(m).k2 = _RGB32(kr2, kg2, kb2)
        rlook(m).k3 = _RGB32(kr3, kg3, kb3)
        rlook(m).k4 = _RGB32(kr4, kg4, kb4)
        rlook(m).k5 = _RGB32(kr5, kg5, kb5)
        rlook(m).k6 = _RGB32(kr6, kg6, kb6)




        draw_robot mmx, mmy, m, 6
        mmx = mmx + 64
        If mmx >= _Width Then
            mmx = 0
            mmy = mmy + 64
        End If
    Next m
    md$ = "Robot Sprite Sheet generated " + Date$ + " at " + Time$
    md2$ = "Mini-Robot-Mixer V0.1 by James D. Jarvis"
    _PrintString (0, 321), md$
    _PrintString (0, 337), md2$
    Do
        _Limit 60
        kk$ = InKey$
    Loop Until kk$ <> ""
    If kk$ = "C" Or kk$ = "c" Or kk$ = "S" Or kk$ = "s" Then
        _ClipboardImage = ms&
        _Delay 0.3
        Locate 1, 1: Print "Sprite Sheet Saved to Clipboard"
        Sleep 3
    End If
Loop Until kk$ = Chr$(27)
_FreeImage part&
System




Sub draw_robot (Mx, my, mid, scale)
    'generate a monster image from source sprite sheet part& and render to the programs main screen ms&
    tempi& = _NewImage(64, 64, 32)
    'tempi& creates a temporary one sprite image for rendering
    _ClearColor clr~&, tempi&
    _Dest tempi&
    Cls

    _PutImage (0 + 16, 12 + 16)-(31 + 16, 43 + 16), part&, tempi&, ((rlook(mid).leg - 1) * 32, 64)-((rlook(mid).leg - 1) * 32 + 31, 64 + 31)
    _PutImage (0 + 4, 0 + 8)-(31 + 4, 31 + 8), part&, tempi&, ((rlook(mid).larm - 1) * 32, 96)-((rlook(mid).larm - 1) * 32 + 31, 96 + 31)
    _PutImage (0 + 28, 0 + 8)-(31 + 28, 31 + 8), part&, tempi&, ((rlook(mid).rarm - 1) * 32, 128)-((rlook(mid).rarm - 1) * 32 + 31, 128 + 31)


    _PutImage (0 + 16, 0 + 16)-(31 + 16, 31 + 16), part&, tempi&, ((rlook(mid).torso - 1) * 32, 32)-((rlook(mid).torso - 1) * 32 + 31, 32 + 31)


    _PutImage (0 + 16, 0)-(31 + 16, 31), part&, tempi&, ((rlook(mid).head - 1) * 32, 0)-((rlook(mid).head - 1) * 32 + 31, 0 + 31)

    _Source tempi&
    'repaint source image with generate color values for new monster sprite
    For y = 0 To 63
        For x = 0 To 63
            Select Case Point(x, y)
                Case kk1
                    PSet (x, y), rlook(mid).k1
                Case kk2
                    PSet (x, y), rlook(mid).k2
                Case kk3
                    PSet (x, y), rlook(mid).k3
                Case kk4
                    PSet (x, y), rlook(mid).k4
                Case kk5
                    PSet (x, y), rlook(mid).k5
                Case kk6
                    PSet (x, y), rlook(mid).k6
            End Select
        Next x
    Next y
    'generated image in tempi& is rendered to ms& as a 64 by 64 sprite

    _PutImage (Mx, my)-(Mx + 63, my + 63), tempi&, ms&
    _Source ms&
    _Dest ms&
    _FreeImage tempi&
End Sub

'================================
'PNG file saved using BASIMAGE1&
'================================
'EXAMPLE USAGE OF BASIMAGE1&
'===========================
'SCREEN _NEWIMAGE(600, 600, 32)
'pic& = BASIMAGE1&: _PUTIMAGE (0, 0), pic&

Function BASIMAGE1& 'robo01.png
    v& = _NewImage(640, 160, 32)
    Dim m As _MEM: m = _MemImage(v&)
    A$ = ""
    A$ = A$ + "haIkM^P]SScZ5^W4o3]<9k9Y_gDM9K46dC#XH_mJ]G9Wh78Q#`WUCZjOnWoi"
    A$ = A$ + "hOPPPPPPPPPN=jkFd]1XadW?OnSR^M01]JURmaL088XE9NNWEW7bJko_oko6"
    A$ = A$ + "^?]mn^>[jgmaEd]G_7oCKX>8d:EDinh]Q_i^BaoAkCPF[NbloooAdcMnTRPA"
    A$ = A$ + "gGN:SolJ^JKNfNncen?A75DWfNfH]e=NOTmj]mogeaTojCBlH`[a#oSmPPnZ"
    A$ = A$ + "D<fGf;ZFM\GdlO?InSMFWnLQjN?YaQIZ;Cm<Ag?l:6PCnhiH_D=GMOoQ;iT>"
    A$ = A$ + "SiY[aeI\?kcj`fo2gS0Wi[E6#cmoM8?S3;5kmTb12]?:KMWo;kE:WcOh`2hn"
    A$ = A$ + "aSPoCKM0nEOn?cHkJO^?fVEkk1c1>:7gCNmoTHolT1\F=gokH^_O;c;9bnYa"
    A$ = A$ + "oe93h8\B[>gC;lON_nOJ[m[5[1k8aRBm?`oi_6Yn;M^YW]1_kcd>R4oGB[Q3"
    A$ = A$ + "86n7]e1`[kkWKOjj]B[kAoLgjk<95GLh`h#6gG9f_5T3NERbl=bjhm4Gk_B\"
    A$ = A$ + "ON`0B[gVHYUHZo`P`^63\9>dEn_>[9aOn?[jnOC]C]f[#J87RmTbc<gj_>B\"
    A$ = A$ + "hGUnNKbonK26#oRc^Fk7mL?UH0]86Xfj?iC]gkC^:aoI53XdmbAGg?9O0mL]"
    A$ = A$ + "lN0KIM0n:_VoAciFRoc;6`?WS[7WekXa6l?gbH_^Io8<PNi;llN?h\K_In_k"
    A$ = A$ + "YNZUoe660YikB\Oef_5i3lUo[mfV6kgZI0WmHV9NhFOF9_SefFRoS>>`SglZ"
    A$ = A$ + "=hALe<]5?bo>2kG96`Ic7AkSJ\?liPFF3VoM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DIc[k5W7h"
    A$ = A$ + "UOoGifO9nPD]>J4gRR5FALnf`o9:QhOUS[?KNM^jaQ]cnIAL?_fK[c1]ZmXc"
    A$ = A$ + "oMY#ho8cmSPoS>Wg3n?No]4o_GOWoUR7mL]VkMNQUaiEW3TbicGgo<64KR5_"
    A$ = A$ + "5S;XElmo;[O;lncHmCGSMnQRiKime5T?FLlIAel?m7dl:4onE>7__g[;F<ng"
    A$ = A$ + "e>?W;NS1lfh_oiP4_GGZFDn?]ijNdO;UKY5i3oGNMXb<Pf\nOJc3FA=XNh0m"
    A$ = A$ + "X]Xco5ljoIH]VRaNK0o7GJ\G[P7R67B]_GfC<ND8^gKKfBn#;_W[An^O8YAK"
    A$ = A$ + "?ReKi_WoW2eS]:fGT3\0gWWL8AM?8I<PWiOF;oA4co^7;hOM_B]QCkN\FOoU"
    A$ = A$ + "ooN<_WnkKlo:im\L>A9V>YLLJ7KOfljL;e^Faj]DJl#Zn[WilX>VMImohgoY"
    A$ = A$ + "mnjblONolOg]h?9koFho:IK?J3K5o7MR>m__jhggg7K__\KeO:`liM^7U2=["
    A$ = A$ + "]60g3\HnSEcn2kon\O9VBIn_ee^R^nk:7o[ike63nUkoURW6AoJmoNK3AJkW"
    A$ = A$ + "Hn_JcejQmKTff9kgTlOnM_Ia<n7=oGdmO8XXEdaoAKoMdgoVl1##[#]N__e^"
    A$ = A$ + "7hA]]EK?Yl2k3ogL?W;888888XO7]ZkoJWGokgPoOTf#dn68888888888888"
    A$ = A$ + "888888888888888888888888888888888888888888888888888888888888"
    A$ = A$ + "8888888888888888888888888888888888888888888888888Xheokomo2_="
    A$ = A$ + "0111mTdW?O<AoZfOff1looff_gfe^=?<Rfb>d_OJaOA?no[e_OJcoKY=\ZnH"
    A$ = A$ + "4S1A?^oF]og[a\Kcd>nN^okon_C9[l3e\SUmkMboo]5<UVdnAfo;??l#imnT"
    A$ = A$ + ";nPZ6llFg>Bm]S:]5;m1A>oG\_>X\XnG[iMl:^OeiModHLnZW;L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img"
    A$ = A$ + ";^Cjk;]?_hQ_amMngnbna7C\fGKml0;\;Yc9DOYnn\PoKd=;iojQi`jH1nhJ"
    A$ = A$ + "YJ=N]><mM?8f6o59ogfcO\0n_Z]37]KTeog=n_NZoK5ogA1Kg:gGjeIJCmkj"
    A$ = A$ + "MnIaZDKjAcomYnoN0VoNWhoLH^nXS9N=f;gOk[n[5SmT>W#Nnjkc:n?]G;]_"
    A$ = A$ + "Eaoial>eaQ6g<WoCH4^X\Rkh8heoKTn>a74:oQ1LH5K3;LMX;=WdckkNWhod"
    A$ = A$ + "77>^mgFcoUNM4^_d[C?GLQiN:iKX_Vle76<O_D<NdlO[nNOkJnhRbiXi?lXV"
    A$ = A$ + "kI<O;YILJ^`>ao=bf:holJNWjh#SK?9n_If\8oGgmMSl1U^?GYL?;Mm_Jd;h"
    A$ = A$ + "M]H?ioXS1Yn=WcAkc\RmSfG[boMh?oG9>`JWcCImoRTo;=cjFm7J\Paiof1n"
    A$ = A$ + "?aLA1OOWF^F3M7c_Pj#k4oWf[UfgCToCbfNO_8I<#BaPROf_ococRfPES1Ja"
    A$ = A$ + "SN<NO6cYbKdWl:FPFWa;o>hoJkOS3mTokLLXe8>7VgaSgdho\L^8_^3_ON>o"
    A$ = A$ + "G:N``l2gJ7ObI#iomBHoZT7J^ke`?eNK`0^_9WC\ClOS\1n?k\O4lOLoO?_^"
    A$ = A$ + "Zk1dcJ>]HO?6_?Si68_[7lOGi?cScdZ;Jih_4ogggbiohOVe]QVho8omCRo["
    A$ = A$ + "Hm#Eic_k3`oEoOooneio:]VVcXFJCESek>kkheTg9n?]G;]?`oIWm1oWNl0h"
    A$ = A$ + "olSoCSm[8ogOm7FF7VbjAiNdn<?RoGAnWMTok<>Xe8>7V;Z=6hE^O=kaSm96"
    A$ = A$ + "m6kWE]WAHRF2oGQLBF4ocSa?VLOPoK`aR1g0oWMfo=coY]FneTWfW?VK]m[V"
    A$ = A$ + "cMYlObio:boIH<hX[og:RoCSmdGWIno>bo]3coFUoWKcJZU=_[1j9k7OnG[i"
    A$ = A$ + "T0ogcRoCkeBk3lOfIoG?oWcceZ>ng9kUEammTceSfAFn#fE?:n?YLkl?kGUo"
    A$ = A$ + "HGiojQgaSlOk6o7WeeKO1]mTV;ZogonlONXFKCEI07Q3L0oa=n_Knkjkc:n_"
    A$ = A$ + "AfF1oWFN9`o1n?C7oG<gEAKgH^H[Vk=L>#7l1Po3lOk0oG]j?Nh;^jgoGHN6"
    A$ = A$ + "og7ongl?nL`BiLV=_3_6REZGOCC<P>W7\fmEhml#;HaG5o7O>XGlO[`_;6;F"
    A$ = A$ + ":nBB;:o;holUoCenETUeLJ>G8co793l_:oa^co]blnAhoWY?_ZJ1[`Wgml#3"
    A$ = A$ + "ON3daH;d8lOYfBgYN<\>4ho6[MhaL^Ejg5S3iaEe4ho\Ml_7I<ogY?XA^7_\"
    A$ = A$ + "McioLHl_g4a[ZV[eco1oG\noIjcJ]7?V?^Jf?eiR6O?_FbmIQ?:OM4K=mSMO"
    A$ = A$ + "7`]#oZfOffQUal`n`nAIoNJ;NHcAl1AJkOiaoA]e>fVn5moN=>hmlA[_nShK"
    A$ = A$ + "RL\NWR9FiH14444444444444444444444444444444444444444444444dkB"
    A$ = A$ + "NoK_0on8PPPPPPPPf;mU=k`IYaommOOFR^o31111m^5Fg3XgXfMn?<732222"
    A$ = A$ + "b;iI=#DOJnaVXogI_8HnGU]STo;]E^__^o]G62222jM9`o]GRcdDcoj3keX3"
    A$ = A$ + "ifnok_[ho[;RRo;moM:bSmSkoacK62222ZThl5Uh>TF[UFg?FKR>7?nkFRYY"
    A$ = A$ + "6Ka\oo^VlJY=7oA?<YJ[Ug8lOmJoXhoXSain1[<kMK2n?8888X_BRQkPmo]Y"
    A$ = A$ + "75nohDjn?>4>g:e0QhnbS\ood]7n?jie;_mO>NjXg\lO\[E?aPdne8lO]bOE"
    A$ = A$ + "cnNcoUJcIS1VKj;kZm\VQPPPPNOZ6ogAUo?^Gkh1oGoS3L^_Iho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ZMgnFW"
    A$ = A$ + "oeBkgCogZaQFJKNN]W]o?Jk\e[QUnTAj3cf_]`7jah#_GC?SkOZJFOl\S=N="
    A$ = A$ + "6fbeeZHZ8lKFHO;l1N?nkmi_;bSfh_#o6222j][F[_5Mk42222222b3m6__e"
    A$ = A$ + "_maS?UOnF_1o0DN<Ad]1Xe?VoFbi][:jJ?B[?Odn48XEYo`ldi_QSOIUHkJQ"
    A$ = A$ + "okhQk;P8Sk3nmO4b^aPH6gS?WGdl?A>>leNFnkHYkaOFnNL_o#_9AWo5aL`E"
    A$ = A$ + ";`o1aeKRoK7onjm7k607f>`oAK3[^]TbmCGo[EG38:n_cLm7<n_6nM[31mD4"
    A$ = A$ + "ho0ogKF9f_Jo^SO2johk6ogn\K]Y\om:J=fNGN^7AaoU\W4ogZJ7ANo7Po32"
    A$ = A$ + "joD4ggGDjX#n6nW3n_W]h\O?M6#`oa7kg7n_Eg>f5n??ngb`Vko_#n_JLfhk"
    A$ = A$ + "4kkC_=n_TViHPN6j=]nOYnk>mlOSPoSbn#O=J6`Uol?9<WWgck2i#g9n_S?_"
    A$ = A$ + "7n?]ahE?n3Mig3mkN3Qok9?^gB]^X[725CLaKPm;eGgUenk\m0n_#\?O]7SH"
    A$ = A$ + "=8gRWoKWooFc_\X<gdaJjLRgbJ1];:beOSO?H?iaMaWg7_0h;iI12mnNn_Yn"
    A$ = A$ + "lKVoSGWSonXI`Rbnk#o?4K;\>P?iioYn=?V7\Oa=F4emoaS5N3SmgZioAim?"
    A$ = A$ + "L>08ihQg`H^>3HPofO1oGHfWFoi=aoMJoG`cmEZOC[ioFZo_C:igCiP`coMM"
    A$ = A$ + "miJlO_1o0DNl`ZonGAOf;aDg?Ff_cfa2ioXnK>gCTiOSRo:e62UoJSioNbO?"
    A$ = A$ + "PNSen7aohagC1YeL=bL`[PoLWR_>ckbhof]i1AmmSIgU5nUXNn_lj][^n[Gi"
    A$ = A$ + "d6^]\Hn?nh`ZkceR7NCfWcoeR<ef<A_n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$ + "_glcoU6[5ALGD?ogMPo:ZWolZkSJng`ioHeRSfG5iHSEc1dZUm[DCcSeoSN]"
    A$ = A$ + "YggA6oWAOWoYnJYef=Jok:77S<f[Gk?jcS<jnY=nYe^^Och_=]O7<o7Wo82N"
    A$ = A$ + "4JLK4f>Bn[EIO][oB^?;RXfCjIR]\fcaJ]k>[4WP]\Oam<M<96aYk7UO_7gh"
    A$ = A$ + "o<hNAhLO]n_agdJ0dGo55]NB4?OYCkcbad23H?]cXFo<[mCAa`VVg55kETlO"
    A$ = A$ + "BiiFmJaa]W7iKeR[h<WNdOSfn9kXUggKkB[ea[]M]oc00g73X\OFV[YDN\ET"
    A$ = A$ + "GK6kK1oG^=dHoFkl\AloLfYnZ3[?7_TXco]8>I4n_[a]lGm8F]5oV5GCY]E`"
    A$ = A$ + "FTU[QYBaTlcYUHeJcelNlKNoT_]oRnj5llO[FogIn_bmoli5UnL?jodSIFkE"
    A$ = A$ + ";o:On_fn\\O^BkG[MYmlO\XfOYnoQdl\Kkg?n_KiQMjIm:EW]Dm7nLaI[;5]"
    A$ = A$ + "m;W7Waoi#\N9NWT_XUhlAWCfcLLYmK9GB=OQd_cW[Ja\Gok\fAWoGCl0TJnP"
    A$ = A$ + "FfhnLYm?Z_ERI#RQXdT09f3]cA[]N=>EOnVUccj?_#ijoUR=Ve>eZab77FEm"
    A$ = A$ + "oKWgTaTSHoNoL_jolcOdiWef:UCH6kfZmeZ7CgWGaOebkKegeYRi5oTon\lo"
    A$ = A$ + "G343e6ZFOI1O?oJYVKb7cSm\hgOAdf_iJnYA2S73JUo[fcoLDOAdcok=F#VK"
    A$ = A$ + "ILn_6QA^c19lIchWCnaJkODOKdlOGkJ_hoVYnoX<7m4GXES?=F<O]_a]_5i3"
    A$ = A$ + "kenFco=JoG:6bkh_NICo5\O9o>mOGgXfT_??ZoO8T[khfn?K#3>g_1^c?ifN"
    A$ = A$ + "ViJBZ7n;YoVnj_Xm;5?LngYA57Z;e3oWdL]dlRAW7dcLL?VogK\P<[1hoZ?>"
    A$ = A$ + "K4oG3OVTohJGk5oG[S9Nao=2o9ohVYoo[JodW9M>mdV6anU>G[R;;M]md^[f"
    A$ = A$ + "nUloUFo?=61[joo99d=N\SlLNG17f?gG`nN<>?;oe:Go??\OKSAnEGZD<0?G"
    A$ = A$ + "TdLQB\QSHoB][Ffg\nRJa0bJLn_FmoRc?9b2OPDM7Jm7_beOcn:m?]aMni8G"
    A$ = A$ + "[L?ioZ=W[Ujoda7c7;4^f]dfNbfGK^ReiRZ=f^2o`KDUhkBk[Dn8[J3I9Tb7"
    A$ = A$ + "X=Qo[7kkE\E?lGBimWe_7]mKILhT2?`igLF?nJ3n4bmd2oWhhS0oWg]C?ho^"
    A$ = A$ + "j?beeFAM696`FVSejLaMSo[UaQBeomRok<>CHlNEL7kZmGEk8JkoFEYk9Cjn"
    A$ = A$ + "cl<n;;OX43XSl7;S_YA9M^cbN<SmGF\8Qo;J6#:cGjm?Ul>daJ9foBWWd[[Z"
    A$ = A$ + "]jAMWBikF53X_m_b\Ok23H]joAaoiYMgMk7]oOen18maVEaMWa0nI=?KfMGF"
    A$ = A$ + "`o]kB^Fen\>P?EOOdLoeJGIi0FhmYmDF_1M6`oni3do\N<8jjoU\O]ffCgn["
    A$ = A$ + "XM4]mQZ?f\BOo]ln_L6#`o5IKjm5_5]n`HnTN_gS9??6#^HIFK\omWceHoAT"
    A$ = A$ + "eo;aF^ReMJW]o:J7AKOXjS?Qco9\60AkGFYoWbomDkkk8o7D<a1lkgClmP1L"
    A$ = A$ + "jnfoaaEN^f=^a>i5KZM4<o1O<V:_7ogMkkMk8Jk3EN\AB[`^lLm_In_Elk_M"
    A$ = A$ + "7T7eGPnMd=f_S?D05aL2P1LlneYK]`L^\iTW7W]lOk0o1g6Lki=oe>KO?K7A"
    A$ = A$ + "KOXbS=Nn_m;ES;4F;PgfH?hoPN;ZUke<\k7UD3JefgEom1QYCYoain\d74Mm"
    A$ = A$ + "oMOmgRfnHmoN_:Bn_cH3RNKSkdhOnof\4MKcWn:Nn__MA30ViH\FUZ5m[6WN"
    A$ = A$ + "bfmihn[WkCHmohb0n_8i?dHIG1[o>KoEd>Rfn#m=f\JOoKN<WbOcOOd]=O6W"
    A$ = A$ + "__F4Ag^PF[>:T_i6C#0iRhL:oj[7A6OG=n?bmUIENIDo72JOeCWkHWe[Vok1"
    A$ = A$ + "f7QZ[4oG2fPcoAolXhoh[;e_N\Zhj0:aoIlJo111]gjYcM\kRn\OObS1Po3j"
    A$ = A$ + "[n5hoTNFUAkg\X_YZ2[oGd]K888o4FgmhEb_odmo8>3JgioTH0SfWiNO6[m7"
    A$ = A$ + "444444TcZEn_XJK_]kCI7nNP3111111m\E[on?R^M211]7jo3#EK%%h1"
    btemp$ = ""
    For i& = 1 To Len(A$) Step 4: B$ = Mid$(A$, i&, 4)
        If InStr(1, B$, "%") Then
            For C% = 1 To Len(B$): F$ = Mid$(B$, C%, 1)
                If F$ <> "%" Then C$ = C$ + F$
            Next: B$ = C$: End If: For j = 1 To Len(B$)
            If Mid$(B$, j, 1) = "#" Then
        Mid$(B$, j) = "@": End If: Next
        For t% = Len(B$) To 1 Step -1
            B& = B& * 64 + Asc(Mid$(B$, t%)) - 48
            Next: X$ = "": For t% = 1 To Len(B$) - 1
            X$ = X$ + Chr$(B& And 255): B& = B& \ 256
    Next: btemp$ = btemp$ + X$: Next
    btemp$ = _Inflate$(btemp$)
    _MemPut m, m.OFFSET, btemp$: _MemFree m
    BASIMAGE1& = _CopyImage(v&): _FreeImage v&
End Function

Print this item

  Alchemy is fixed!
Posted by: PhilOfPerth - 11-21-2022, 05:54 AM - Forum: Programs - Replies (30)

To those of you who helped with my previous feeble attempt at this programme, thank you!

Alchemy has been completely re-worked and has a few extra features:

  • The previous best train of changes for each pair can be viewed.
  • Selection of a pair is simplified
  • An additional set of word-pairs can be substituted by "commenting out" the first two data lines.
  • All files are now correctly attached as a .zip file and can be extracted to the Alchemy folder.

I would appreciate any feedback on the new version.
Code: (Select All)
Screen 9
_FullScreen
Clear
DefInt A-Z
Common Shared try$, fail, tries, prev$, tryvert, targets(), target, firstwords$(), first$, lastwords$(), last$, pairnumber$, pairnumber, names$(), name$, ok$, fail$, temp$
Common Shared added$, removed$, ln$, train$()

maxtries = 20: minsize = 2: ok$ = "o3l32cego4c": fail$ = "o2l16co1gec"
Dim firstwords$(20), lastwords$(20), targets(20), names$(20), train$(20)
Randomize Timer

Data "BIG","SMALL","LION","TIGER","CAR","TRUCK","BLACK","WHITE","WEED","FLOWER","BEDROOM","KITCHEN","COPPER","BRASS","DESERT","OASIS","MILK","HONEY","HORSE","SHEEP"
Data "BADGE","MEDAL","MARRY","DIVORCE","SHED","HOUSE","WAR","PEACE","SUIT","DRESS","BOX","CARTON","ROAD","STREET","DUNCE","GENIUS","CUP","PLATE","STEAK","EGGS"

Data "ORB","SCEPTRE","TOWN","VILLAGE","BURGER","CHIPS","YOUTH","MAIDEN","OLD","NEW","FAKE","GENUINE","TEA","COFFEE","DRESS","SKIRT","PLANTS","WEEDS","PENCIL","CRAYON"
Data "GLASS","BEAKER","GUITAR","PIANO","SLATE","STONE","CORD","ROPE","JUNGLE","DESERT","PANTRY","CUPBOARD","BROOM","SHOVEL","FOOD","DRINK","ORANGE","LEMON","SINNER","SAINT"


AlchemyDescription:
Print
Color 14
Print Tab(36); "ALCHEMY": Color 15
Print
Print " Alchemy (al/ke/mi) can be defined as the process of changing something into"
Print " something different in a mystical way, such as changing ";: Color 14: Print "STONE";: Color 15
Print " into ";: Color 14: Print "GOLD.": Color 15
Print
Print " This game calls upon your skills in this art, to change a word into a"
Print " totally different one, with the least number of changes."
Print
Print " In the usual word-swap game, you repeatedly change one letter of a word for a"
Print " different one, creating a new word, until the target word is produced."
Print
Print " But in Alchemy, you have another tool available to you for the transformation."
Print " You can also ";: Color 14: Print "add";: Color 15: Print " or ";: Color 14: Print "remove";: Color 15: Print " a letter, before re-arranging them, so the word may"
Print " change in length several times as you progress."
Print
Print " As an example, we can change STONE into GOLD with 4 changes:"
Color 14: Print Tab(23); "STONE - TONE - GONE - LONG - GOLD": Color 15
Print
Print " If the wordslists directory is present, each word entered is checked against"
Print " these. If not, they are assumed to be legitimate words."
Print " The wordlist files are the Complete Collins Scrabble Words (2019)."
Print: Color 14
Print Tab(29); "Press a key to continue"
While InKey$ = "": Wend
Play ok$
LoadPairs

Choice: '                                                                                     invites replacing best scores in file with defaults
Color 14
Locate 23, 17
Print "Would you like to delete all previous results (y/n)";
Sleep
Color 15: y$ = UCase$(InKey$)
If y$ = "Y" Then
    Refresh
    Play ok$
    LoadPairs
End If

SetPair: '                                                                                     Select pair of words
LoadPairs
Color 14: Print Tab(22); "Which pair would you like, from A to T";
getpair:
pair$ = UCase$(InKey$)
If pair$ < "A" Or pair$ > "T" Then GoTo getpair
If pair$ = Chr$(27) Then Stop
pairnumber = Asc(pair$) - 64
Locate 23, 15: Print "Would you like to peek at the previous best solution (y/n)"
showchain:
k$ = InKey$
If k$ = "" Then GoTo showchain
If UCase$(k$) = "Y" Then ShowBest
StartGame:
Cls
remain = 21: tries = 0: fail = 0 '                                                             start each game with 21 tries remaining
first$ = firstwords$(pairnumber): last$ = lastwords$(pairnumber)
train$(pairnumber) = first$
target = targets(pairnumber): name$ = names$(pairnumber) '                                      get  selected pair details
prev$ = first$ '                                                                                pretend the first was a previous try
Color 14
Locate 1, 39 - Int(Len(first$) / 2): Print first$; Tab(52); "Record:"; target '                 display the first word in yellow on row 2
Color 15
For a = 2 To maxtries + 1: Locate a, 35
Print String$(9, "."): Next '                                                                   show 9 dots for each try (rows 2 to 21)
Color 14
Locate 22, 39 - Int(Len(last$) / 2): Print last$; '                                             display the last word in yellow on row 23
tryvert = 2 '                                                                                   row 3 will take the first try

InviteTry:
If tries = maxtries Then
    Play fail$
    WIPE "23": Color 3:
    Locate 23, 21: Print "You've Used up all of your tries, sorry!"
    WIPE "24"
    Color 15
    Sleep 3
    GoTo StartGame '                                                                             ran out of tries, restart the same pair
Else
    Locate tryvert, 35: Print String$(9, "."); Tab(46); Space$(30)
    WIPE "23": Color 14 '                                                                        refresh remaining tries advice
    Locate 23, 27
    Print "You have"; 20 - tries; "tries remaining"
    Locate tryvert, 3 '                                                                          display invite at tab 10 of current try-line
    Print "Your word (q to quit)";
End If

DealWithTry:
Locate tryvert, 25
Input try$ '                                                                                     show ? outside try-line and set try to first dot
Color 15
try$ = UCase$(try$)
If try$ = "Q" Then Stop
If try$ < "A" Or try$ > "Z" Then Play fail$: GoTo SetPair
tries = tries + 1
Locate tryvert, 35: Print Space$(12)
Locate tryvert, 39 - Int(Len(try$) / 2): Print try$
CheckWord '                                                                                       Call Sub to Check the Player's Word

DealWithCheck:
Locate tryvert, 1: Print Space$(35)
If fail = 1 Then
    Locate tryvert, 35: Print "         "
    Color 3
    Locate tryvert, 39 - Len(try$) / 2
    Print try$
    Color 15
    tryvert = tryvert + 1
    GoTo InviteTry
Else
    If try$ = last$ Then
        Finished
        GoTo SetPair
    Else
        Locate 23, 30
        Print Space$(50)
        tryvert = tryvert + 1
        GoTo InviteTry
    End If
End If

Sub Refresh
    Restore
    target = 21: name$ = "UNSOLVED!"
    Open "alchpairs" For Output As #1
    For a = 1 To 20
        train$(a) = "UNSOLVED!"
        Read first$, last$
        Write #1, first$, last$, target, name$, train$(a)
        Print first$; " "; last$; target; name$
    Next
    Close
    Cls
End Sub

Sub WIPE (ln$) '                                                                                  call with ln$ string of 2-digit line numbers only  eg "012223"  for lines 1, 22 and 23
    For a = 1 To Len(ln$) - 1 Step 2
        Locate Val(Mid$(ln$, a, 2)): Print Space$(80);
    Next
End Sub

Sub LoadPairs
    Restore
    Cls
    Color 14: Print Tab(37); "Word Pairs"
    Print Tab(20); "Pair"; Tab(30); "From"; Tab(41); "To"; Tab(50); "Best"; Tab(62); "By"
    Color 15
    If _FileExists("alchpairs") Then
        Open "alchpairs" For Input As #1
        For a = 1 To 20
            Input #1, firstwords$(a), lastwords$(a), targets(a), names$(a), train$(a) '                      loads word-pairs from "alchpairs" file
            Color 14: Print Tab(20); Chr$(a + 64);: Color 15: Print Tab(30); firstwords$(a); Tab(40); lastwords$(a); Tab(50); targets(a); Tab(60); names$(a)
        Next
        Close #1
    Else Refresh
    End If
End Sub

Sub ShowBest
    Cls: Locate 12, 2
    If train$(pairnumber) = "UNSOLVED!" Then Print Tab(35);
    Print train$(pairnumber): Sleep 2: Cls
End Sub

Sub CheckWord
    added = 0: added$ = "": removed = 0: removed$ = "": fail = 0 '                                 initialise added, removed and fail flag
    Locate tryvert, 48: Print Space$(32)
    Locate tryvert, 48
    CountAdded:
    temp$ = prev$ '                                                                                 use temp$ as sacrificial to keep prev$ intact while checking for added
    For a = 1 To Len(try$) '                                                                        for each letter in try$...
        l$ = Mid$(try$, a, 1) '                                                                     take a letter l$ of temp$
        po = InStr(temp$, l$) '                                                                     find its position po in temp$ (if any)
        If po < 1 Then '                                                                            if not found...
            added = added + 1
            added$ = added$ + l$ '                                                                   count it and add to added$
        Else
            Mid$(temp$, po, 1) = " "
        End If
    Next

    CountRemoved:
    temp$ = try$ '                                                                                     use temp$ as sacrificial to keep prev$ intact while checking for added
    For a = 1 To Len(prev$) '                                                                          for each letter in try$...
        l$ = Mid$(prev$, a, 1) '                                                                       take a letter l$ of temp$
        po = InStr(temp$, l$) '                                                                        find its position po in temp$ (if any)
        If po < 1 Then '                                                                               if not found...
            removed = removed + 1
            removed$ = removed$ + l$ '                                                                 add it to added$
        Else
            Mid$(temp$, po, 1) = " "
        End If
    Next
    If added > 1 Then Color 3 Else Color 15
    Print "Added "; added$;
    If removed > 1 Then Color 3 Else Color 15
    Print Tab(60); "Removed "; removed$ '                                                               show letters that have been added or removed, colour cyan if too many

    DictionaryCheck:
    If Not _DirExists("wordlists") Then isaword = 1: GoTo checksfinished
    WIPE "23"
    filename$ = "wordlists/" + Left$(try$, 1) '                                                        select dictionary file of first letter of try-word
    Open filename$ For Input As #1
    getaword:
    isaword = 0
    While Not EOF(1)
        Input #1, dictword$ '                                                                          read each word from dictionary
        If try$ = dictword$ Then isaword = 1: Exit While '                                             if word is found, don't look any further
    Wend
    Close
    checksfinished:
    Locate 23, 1
    If added > 1 Or removed > 1 Or isaword = 0 Then '                                                  if more than one letter added or removed, or word not found, set fail flag
        Play fail$
        Color 3 '                                                                                      colour of try changed to cyan if word failed
        Print Tab(35); "Word failed";
        Color 15
        fail = 1
    Else
        Play ok$
        Print Tab(37); "Word ok"; '                                                                     otherwise, declare word as ok and make this the new prev$
        prev$ = try$
        train$(pairnumber) = train$(pairnumber) + "-" + try$
    End If
    Sleep 1
    WIPE "23"
End Sub

Sub Finished
    Play ok$: Play ok$
    Locate tryvert, 35: Print Space$(12)
    Locate tryvert, 39 - Len(try$) / 2: Print try$
    WIPE "2223"
    Locate 22, 21: Color 14: Print "You did it in"; tries; "changes.  Target was"; targets(pairnumber)
    Sleep 2
    If tries >= targets(pairnumber) Then '                                                              if target is not beaten,
        Exit Sub '                                                                                      go back for next game
    Else
        targets(pairnumber) = tries '                                                                   change the target for that pair to the new best score
        Cls
        Locate 10, 4
        Input "Enter a name for the Best Scores list (or <ENTER> for anonymous)"; winname$ '            get the player's name
        If Len(winname$) < 2 Then winname$ = "ANONYMOUS" '                                              if <ENTER> (or only one character) is given, name is Anonymous
        names$(pairnumber) = UCase$(winname$) '                                                         change the name for that pair to the new name
        Open "alchpairs" For Output As #1
        For a = 1 To 20
            Write #1, firstwords$(a), lastwords$(a), targets(a), names$(a), train$(a) '                            re-write the alchpairs file with the new details
        Next
        Close
    End If
    Cls
    Locate 10, 40 - Len(train$(pairnumber)) / 2: Print train$(pairnumber)
    Print: Print Tab(36); "Press a key"
    Sleep
End Sub



Attached Files
.zip   wordlists.zip (Size: 713.77 KB / Downloads: 53)
Print this item

  Make5 - Board clearing puzzle game
Posted by: Dav - 11-21-2022, 01:55 AM - Forum: Dav - Replies (9)

Make5.bas is a small puzzle game where you try to clear the board by removing pieces of the same color.  You remove them by making combinations of 5 or more pieces of the same color in the same row or column.  Click on the ball to move, then click where you want to move it to.  Only large balls can be moved.

Points are scored for pieces that you clear off the board.  When the board gets full and no possible moves left then the game is over.  See how many points you can make before it's over.

This is an updated and enhanced version of the one posted at the old forum.  This new one auto sizes to fit users desktop (not hard coded to a small resolution), the Hi Score is now saved to file, matches are now found both ways at the same time (row+col), and the board and pieces have a better look.

- Dav

Code: (Select All)
'=========
'MAKE5.bas v2.1
'=========
'A board clearing puzzle game.
'Clear the board of balls and score points.
'Make rows/colums of 5 or more of same color.
'Coded by Dav, JUL/2023 for QB64-Phoenix Edition.

'New for version 2.1:
'
'                    - Added _ICON call for Linux users.
'                      (Needed for QB64PE icon to be used by program)
'                    - Removed slow _MOUSEINPUT polling for faster method.
'                    - Because mouse is faster, the board size can now be
'                      bigger on larger desktops (not capped out as before).

'===========
'HOW TO PLAY:
'===========

'Colored balls will appear randomly on the playing board.
'Move bigger balls of same color next to each other to form
'rows and columns of the same color. Make a row/column of 5
'or more of same color to erase them and score points.

'Three new smaller balls will appear after every move.
'The smaller balls will grow into big ones on the next move.
'You may move the big balls on top of the smaller ones.

'The goal is to see how many points you can score before
'running out of board space, in which the game will end.

'High score is save to a 'make5.dat' file.

'You can press SPACE to restart game.

'=========================================================

_ICON

RANDOMIZE TIMER

'This game was originally designed in 600x650.
'Here's a way to adapt that code to adjust larger screens.
'The df is a small display fix for autosizing to desktop.
'The .80 means it will size up to 80% of desktop height
'We will add a *df to any x/y used in a command.
DIM SHARED df: df = (_DESKTOPHEIGHT / 600) * .80

'set original screen size, but use the df value.
SCREEN _NEWIMAGE(600 * df, 650 * df, 32)

DO: LOOP UNTIL _SCREENEXISTS
_TITLE "Make5 Puzzle"

'=== define board info
DIM SHARED rows, cols, size, score, hiscore
rows = 9: cols = 9: size = _WIDTH / cols
DIM SHARED box.v(rows * cols), box.s(rows * cols) 'value, size
DIM SHARED box.x(rows * cols), box.y(rows * cols) 'x/y's
DIM SHARED checks(rows * cols) 'extra array for checking
'
'=== load hi score from file
IF _FILEEXISTS("make5.dat") THEN
    scr = FREEFILE
    OPEN "make5.dat" FOR BINARY AS #scr
    hiscore = CVL(INPUT$(4, scr))
    IF hiscore < 0 THEN hiscore = 0 'a failsafe
    CLOSE #scr
END IF

'=======
restart:
'=======

PLAY "MBL32O3CEGEC"

score = 0

'CLS , _RGB(13, 13, 13)

bc = 1 'counter
FOR c = 1 TO cols
    FOR r = 1 TO rows
        x = (r * size) '(df is already computed in the 'size')
        y = (50 * df) + (c * size)
        box.x(bc) = x - size
        box.y(bc) = y - size
        box.v(bc) = 0 'zero means no color, empty box
        box.s(bc) = 1 ' 1 = small size piece
        bc = bc + 1
    NEXT
NEXT

MakeNewBalls 3, 1 'put 3 big balls on board
MakeNewBalls 3, 2 'put 3 small balls on board

'====
main:
'====

selected = 0

UpdateBoard

second: 'Go back here when making second choice
_DISPLAY

DO

    'wait until mouse button up to continue
    WHILE _MOUSEBUTTON(1) <> 0: n = _MOUSEINPUT: WEND

    WHILE _MOUSEINPUT: WEND

    'highlight box when a box is selected
    IF selected = 1 THEN
        LINE (box.x(t) + 2, box.y(t) + 2)-(box.x(t) + size - 2, box.y(t) + size - 2), _RGB(RND * 255, RND * 255, RND * 255), B
        LINE (box.x(t) + 3, box.y(t) + 3)-(box.x(t) + size - 3, box.y(t) + size - 3), _RGB(RND * 255, RND * 255, RND * 255), B
        LINE (box.x(t) + 4, box.y(t) + 4)-(box.x(t) + size - 4, box.y(t) + size - 4), _RGB(RND * 255, RND * 255, RND * 255), B
        _DISPLAY
    END IF


    'If user clicked mouse
    IF _MOUSEBUTTON(1) THEN

        'see where they clicked
        mx = _MOUSEX: my = _MOUSEY

        'cycle through all Check blocks...
        FOR t = 1 TO (rows * cols)

            'Block loction...
            tx = box.x(t): tx2 = box.x(t) + size
            ty = box.y(t): ty2 = box.y(t) + size

            'if clicked on a box clicked
            IF mx >= tx AND mx <= tx2 THEN
                IF my >= ty AND my <= ty2 THEN

                    'if this is a first choice...
                    IF selected = 0 THEN

                        'only select boxes not empty, with big size balls
                        IF box.v(t) <> 0 AND box.s(t) = 2 THEN
                            selected = 1
                            SOUND 3000, .1 'made a select
                            oldt = t
                            oldtv = box.v(t) 'save picked box number color
                            GOTO second 'now get second choice
                        END IF

                    END IF

                    IF selected = 1 THEN 'making second choice

                        'if selected an empty box or small ball
                        IF box.v(t) = 0 OR box.s(t) = 1 THEN

                            'swap 2nd box data
                            box.v(t) = oldtv
                            box.s(t) = 2
                            'erase 1st box data
                            box.v(oldt) = 0
                            box.s(oldt) = 1
                            SOUND 2000, .1
                            UpdateBoard
                            '===============================

                            'Grow small balls
                            FOR d = 1 TO rows * cols
                                IF box.v(d) <> 0 AND box.s(d) = 1 THEN box.s(d) = 2
                            NEXT

                            UpdateBoard

                            'copy current box values into checking array
                            FOR i = 1 TO (rows * cols)
                                checks(i) = box.v(i)
                            NEXT

                            'check Rows for 5 or more done
                            FOR i = 1 TO (rows * cols) STEP 9
                                CheckRow i
                            NEXT

                            'Check Cols for 5 or more
                            FOR i = 1 TO 9
                                CheckCol i
                            NEXT

                            'copy checking values back into box values
                            FOR i = 1 TO (rows * cols)
                                IF checks(i) = 0 THEN
                                    box.v(i) = 0: box.s(i) = 1
                                END IF
                            NEXT

                            'See how many boxes left to use...
                            howmany = 0
                            FOR h = 1 TO rows * cols
                                'empty ones
                                IF box.v(h) = 0 THEN howmany = howmany + 1
                            NEXT

                            'If not enough spaces left, game over
                            IF howmany < 3 THEN
                                LINE (200 * df, 250 * df)-(400 * df, 350 * df), _RGB(0, 0, 0), BF
                                LINE (200 * df, 250 * df)-(400 * df, 350 * df), _RGB(255, 255, 255), B
                                PPRINT 233 * df, 285 * df, 18 * df, _RGB(255, 255, 255), 0, "GAME OVER"
                                PLAY "mbl16o2bagfedc"
                                _DISPLAY: SLEEP 6
                                GOTO restart
                            END IF

                            'make 3 more random small balls
                            MakeNewBalls 3, 1
                            GOTO main

                        ELSE

                            'if clicked on another big ball instead...
                            IF box.s(t) = 2 THEN
                                'clear previous highlighted selection
                                selected = 0
                                UpdateBoard
                                selected = 1
                                oldt = t
                                oldtv = box.v(t) 'save picked box number color
                                SOUND 3000, .1
                                GOTO second
                            END IF

                        END IF

                    END IF

                END IF
            END IF

        NEXT

    END IF

    _DISPLAY

    IF INKEY$ = " " THEN GOTO restart

LOOP

SUB CheckRow (num)

    'space to hold box nums to clear
    REDIM nums(9)

    'found some to clear flag
    rdone = 0

    'set place and num
    rc = 1
    nums(1) = num

    'step through the boxes

    FOR r = (num + 1) TO (num + 8)

        'if this box is same as previous...
        IF box.s(r) = 2 AND box.v(r) = box.v(nums(rc)) THEN
            'store this box value in nums too
            nums(rc + 1) = r
            'increase how many so far
            rc = rc + 1
        ELSE
            'bot same, so reset

            IF rdone = 0 THEN
                'no more, so start over from here
                ERASE nums
                REDIM nums(9)
                rc = 1: nums(1) = r
            ELSE
                'no more can exists on line
                EXIT FOR
            END IF
        END IF

        'if there was 5 or more found
        IF rc >= 5 THEN rdone = 1

    NEXT

    'if group was found, clear
    IF rdone = 1 THEN
        PLAY "mbl32o3cdefga"
        'step through nums values
        FOR d = 1 TO 9
            IF nums(d) <> 0 THEN

                score = score + 55 '55 points per ball

                x = box.x(nums(d)): y = box.y(nums(d))
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(255, 255, 255), BF
                _DELAY .025: _DISPLAY
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(64, 64, 64), BF
                _DELAY .025: _DISPLAY
                checks(nums(d)) = 0 'mark checking array
            END IF
        NEXT
    END IF

    ERASE nums

END SUB

SUB CheckCol (num)

    'space to hold box nums to clear
    REDIM nums(9)

    'found some to clear flag
    rdone = 0

    'set place and num
    rc = 1
    nums(1) = num

    'step through the boxes

    FOR r = (num + 9) TO (rows * cols) STEP 9

        'if this box is same as previous...
        IF box.s(r) = 2 AND box.v(r) = box.v(nums(rc)) THEN
            'store this box value in nums too
            nums(rc + 1) = r
            'increase how many so far
            rc = rc + 1
        ELSE
            'bot same, so reset

            IF rdone = 0 THEN
                'no more, so start over from here
                ERASE nums
                REDIM nums(9)
                rc = 1: nums(1) = r
            ELSE
                'no more can exists on line
                EXIT FOR
            END IF
        END IF

        'if there was 5 or more found
        IF rc >= 5 THEN rdone = 1

    NEXT

    'if group was found, clear
    IF rdone = 1 THEN
        PLAY "mbl32o3cdefga"
        'step through nums values
        FOR d = 1 TO 9
            IF nums(d) <> 0 THEN
                score = score + 55 'add to score
                x = box.x(nums(d)): y = box.y(nums(d))
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(255, 255, 255), BF
                _DELAY .025: _DISPLAY
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(64, 64, 64), BF
                _DELAY .025: _DISPLAY
                checks(nums(d)) = 0 'mark checking array
            END IF
        NEXT
    END IF

    ERASE nums

END SUB


SUB UpdateBoard

    CLS , _RGB(96, 96, 96)

    PPRINT 20 * df, 14 * df, 15 * df, _RGB(255, 255, 0), 0, "SCORE:" + LTRIM$(STR$(score))
    IF score >= hiscore THEN
        hiscore = score
        SaveScore
    END IF
    PPRINT 475 * df, 14 * df, 15 * df, _RGB(255, 150, 150), 0, "HI:" + LTRIM$(STR$(hiscore))

    PPRINT 222 * df, 12 * df, 24 * df, _RGB(1, 1, 1), 0, "-=MAKE5=-"
    PPRINT 220 * df, 10 * df, 24 * df, _RGB(255, 255, 255), 0, "-=MAKE5=-"

    '=== draw board based on box values
    bc = 1 'counter
    FOR cl = 1 TO cols
        FOR ro = 1 TO rows
            '=== if empty box
            IF box.v(bc) = 0 THEN
                LINE (box.x(bc) + 2, box.y(bc) + 2)-(box.x(bc) + size - 2, box.y(bc) + size - 2), _RGB(32, 32, 32), BF
            ELSE
                LINE (box.x(bc) + 2, box.y(bc) + 2)-(box.x(bc) + size - 2, box.y(bc) + size - 2), _RGB(32, 32, 32), BF
                '=== draw color ball
                x2 = box.x(bc) + (size / 2) 'find middle of box
                y2 = box.y(bc) + (size / 2)
                IF box.s(bc) = 1 THEN sz = size / 4 ELSE sz = size / 2
                SELECT CASE box.v(bc)
                    CASE IS = 1: r = 255: g = 64: b = 64 'red
                    CASE IS = 2: r = 64: g = 232: b = 64 'green
                    CASE IS = 3: r = 64: g = 64: b = 255 'blue
                    CASE IS = 4: r = 255: g = 255: b = 0 'yellow
                    CASE IS = 5: r = 255: g = 255: b = 255 'white
                END SELECT
                'draw colored balls
                FOR s = 1 TO (sz - 4) STEP .3
                    CIRCLE (x2, y2), s, _RGB(r, g, b)
                    r = r - 1: g = g - 1: b = b - 1
                NEXT

            END IF
            bc = bc + 1
        NEXT
    NEXT

    'overlay a very faint QB64-PE icon on board
    _SETALPHA 16, , -11: _PUTIMAGE (0, 50 * df)-(_WIDTH, _HEIGHT), -11

    _DISPLAY
    _ICON _DISPLAY 'update app icon on taskbar
END SUB

SUB MakeNewBalls (num, ballsize)
    'Assign 3 new balls
    newball = 0
    DO
        c = INT((RND * (cols * rows)) + 1)
        IF box.v(c) = 0 THEN
            box.v(c) = INT((RND * 5) + 1)
            box.s(c) = ballsize
            newball = newball + 1
        END IF
        IF newball = num THEN EXIT DO
    LOOP
END SUB

SUB PPRINT (x, y, size, clr&, trans&, text$)
    orig& = _DEST
    bit = 32: IF _PIXELSIZE(0) = 1 THEN bit = 256
    FOR t = 0 TO LEN(text$) - 1
        pprintimg& = _NEWIMAGE(16, 16, bit)
        _DEST pprintimg&
        CLS , trans&: COLOR clr&
        PRINT MID$(text$, t + 1, 1);
        _CLEARCOLOR _RGB(0, 0, 0), pprintimg&
        _DEST orig&
        x1 = x + (t * size): x2 = x1 + size
        y1 = y: y2 = y + size
        _PUTIMAGE (x1 - (size / 2), y1)-(x2, y2 + (size / 3)), pprintimg&
        _FREEIMAGE pprintimg&
    NEXT
END SUB

SUB SaveScore
    'Out with the old
    IF _FILEEXISTS("make5.dat") THEN KILL "make5.dat"
    'In with the new
    scr = FREEFILE
    OPEN "make5.dat" FOR OUTPUT AS #scr
    hi$ = MKL$(hiscore)
    PRINT #scr, hi$;
    CLOSE #scr
END SUB

   

Print this item

  Make5 - Board clearing puzzle game
Posted by: Dav - 11-21-2022, 01:55 AM - Forum: Games - Replies (9)

Make5.bas is a small puzzle game where you try to clear the board by removing pieces of the same color.  You remove them by making combinations of 5 or more pieces of the same color in the same row or column.  Click on the ball to move, then click where you want to move it to.  Only large balls can be moved.

Points are scored for pieces that you clear off the board.  When the board gets full and no possible moves left then the game is over.  See how many points you can make before it's over.

This is an updated and enhanced version of the one posted at the old forum.  This new one auto sizes to fit users desktop (not hard coded to a small resolution), the Hi Score is now saved to file, matches are now found both ways at the same time (row+col), and the board and pieces have a better look.

- Dav

Code: (Select All)
'=========
'MAKE5.bas v2.1
'=========
'A board clearing puzzle game.
'Clear the board of balls and score points.
'Make rows/colums of 5 or more of same color.
'Coded by Dav, JUL/2023 for QB64-Phoenix Edition.

'New for version 2.1:
'
'                    - Added _ICON call for Linux users.
'                      (Needed for QB64PE icon to be used by program)
'                    - Removed slow _MOUSEINPUT polling for faster method.
'                    - Because mouse is faster, the board size can now be
'                      bigger on larger desktops (not capped out as before).

'===========
'HOW TO PLAY:
'===========

'Colored balls will appear randomly on the playing board.
'Move bigger balls of same color next to each other to form
'rows and columns of the same color. Make a row/column of 5
'or more of same color to erase them and score points.

'Three new smaller balls will appear after every move.
'The smaller balls will grow into big ones on the next move.
'You may move the big balls on top of the smaller ones.

'The goal is to see how many points you can score before
'running out of board space, in which the game will end.

'High score is save to a 'make5.dat' file.

'You can press SPACE to restart game.

'=========================================================

_ICON

RANDOMIZE TIMER

'This game was originally designed in 600x650.
'Here's a way to adapt that code to adjust larger screens.
'The df is a small display fix for autosizing to desktop.
'The .80 means it will size up to 80% of desktop height
'We will add a *df to any x/y used in a command.
DIM SHARED df: df = (_DESKTOPHEIGHT / 600) * .80

'set original screen size, but use the df value.
SCREEN _NEWIMAGE(600 * df, 650 * df, 32)

DO: LOOP UNTIL _SCREENEXISTS
_TITLE "Make5 Puzzle"

'=== define board info
DIM SHARED rows, cols, size, score, hiscore
rows = 9: cols = 9: size = _WIDTH / cols
DIM SHARED box.v(rows * cols), box.s(rows * cols) 'value, size
DIM SHARED box.x(rows * cols), box.y(rows * cols) 'x/y's
DIM SHARED checks(rows * cols) 'extra array for checking
'
'=== load hi score from file
IF _FILEEXISTS("make5.dat") THEN
    scr = FREEFILE
    OPEN "make5.dat" FOR BINARY AS #scr
    hiscore = CVL(INPUT$(4, scr))
    IF hiscore < 0 THEN hiscore = 0 'a failsafe
    CLOSE #scr
END IF

'=======
restart:
'=======

PLAY "MBL32O3CEGEC"

score = 0

'CLS , _RGB(13, 13, 13)

bc = 1 'counter
FOR c = 1 TO cols
    FOR r = 1 TO rows
        x = (r * size) '(df is already computed in the 'size')
        y = (50 * df) + (c * size)
        box.x(bc) = x - size
        box.y(bc) = y - size
        box.v(bc) = 0 'zero means no color, empty box
        box.s(bc) = 1 ' 1 = small size piece
        bc = bc + 1
    NEXT
NEXT

MakeNewBalls 3, 1 'put 3 big balls on board
MakeNewBalls 3, 2 'put 3 small balls on board

'====
main:
'====

selected = 0

UpdateBoard

second: 'Go back here when making second choice
_DISPLAY

DO

    'wait until mouse button up to continue
    WHILE _MOUSEBUTTON(1) <> 0: n = _MOUSEINPUT: WEND

    WHILE _MOUSEINPUT: WEND

    'highlight box when a box is selected
    IF selected = 1 THEN
        LINE (box.x(t) + 2, box.y(t) + 2)-(box.x(t) + size - 2, box.y(t) + size - 2), _RGB(RND * 255, RND * 255, RND * 255), B
        LINE (box.x(t) + 3, box.y(t) + 3)-(box.x(t) + size - 3, box.y(t) + size - 3), _RGB(RND * 255, RND * 255, RND * 255), B
        LINE (box.x(t) + 4, box.y(t) + 4)-(box.x(t) + size - 4, box.y(t) + size - 4), _RGB(RND * 255, RND * 255, RND * 255), B
        _DISPLAY
    END IF


    'If user clicked mouse
    IF _MOUSEBUTTON(1) THEN

        'see where they clicked
        mx = _MOUSEX: my = _MOUSEY

        'cycle through all Check blocks...
        FOR t = 1 TO (rows * cols)

            'Block loction...
            tx = box.x(t): tx2 = box.x(t) + size
            ty = box.y(t): ty2 = box.y(t) + size

            'if clicked on a box clicked
            IF mx >= tx AND mx <= tx2 THEN
                IF my >= ty AND my <= ty2 THEN

                    'if this is a first choice...
                    IF selected = 0 THEN

                        'only select boxes not empty, with big size balls
                        IF box.v(t) <> 0 AND box.s(t) = 2 THEN
                            selected = 1
                            SOUND 3000, .1 'made a select
                            oldt = t
                            oldtv = box.v(t) 'save picked box number color
                            GOTO second 'now get second choice
                        END IF

                    END IF

                    IF selected = 1 THEN 'making second choice

                        'if selected an empty box or small ball
                        IF box.v(t) = 0 OR box.s(t) = 1 THEN

                            'swap 2nd box data
                            box.v(t) = oldtv
                            box.s(t) = 2
                            'erase 1st box data
                            box.v(oldt) = 0
                            box.s(oldt) = 1
                            SOUND 2000, .1
                            UpdateBoard
                            '===============================

                            'Grow small balls
                            FOR d = 1 TO rows * cols
                                IF box.v(d) <> 0 AND box.s(d) = 1 THEN box.s(d) = 2
                            NEXT

                            UpdateBoard

                            'copy current box values into checking array
                            FOR i = 1 TO (rows * cols)
                                checks(i) = box.v(i)
                            NEXT

                            'check Rows for 5 or more done
                            FOR i = 1 TO (rows * cols) STEP 9
                                CheckRow i
                            NEXT

                            'Check Cols for 5 or more
                            FOR i = 1 TO 9
                                CheckCol i
                            NEXT

                            'copy checking values back into box values
                            FOR i = 1 TO (rows * cols)
                                IF checks(i) = 0 THEN
                                    box.v(i) = 0: box.s(i) = 1
                                END IF
                            NEXT

                            'See how many boxes left to use...
                            howmany = 0
                            FOR h = 1 TO rows * cols
                                'empty ones
                                IF box.v(h) = 0 THEN howmany = howmany + 1
                            NEXT

                            'If not enough spaces left, game over
                            IF howmany < 3 THEN
                                LINE (200 * df, 250 * df)-(400 * df, 350 * df), _RGB(0, 0, 0), BF
                                LINE (200 * df, 250 * df)-(400 * df, 350 * df), _RGB(255, 255, 255), B
                                PPRINT 233 * df, 285 * df, 18 * df, _RGB(255, 255, 255), 0, "GAME OVER"
                                PLAY "mbl16o2bagfedc"
                                _DISPLAY: SLEEP 6
                                GOTO restart
                            END IF

                            'make 3 more random small balls
                            MakeNewBalls 3, 1
                            GOTO main

                        ELSE

                            'if clicked on another big ball instead...
                            IF box.s(t) = 2 THEN
                                'clear previous highlighted selection
                                selected = 0
                                UpdateBoard
                                selected = 1
                                oldt = t
                                oldtv = box.v(t) 'save picked box number color
                                SOUND 3000, .1
                                GOTO second
                            END IF

                        END IF

                    END IF

                END IF
            END IF

        NEXT

    END IF

    _DISPLAY

    IF INKEY$ = " " THEN GOTO restart

LOOP

SUB CheckRow (num)

    'space to hold box nums to clear
    REDIM nums(9)

    'found some to clear flag
    rdone = 0

    'set place and num
    rc = 1
    nums(1) = num

    'step through the boxes

    FOR r = (num + 1) TO (num + 8)

        'if this box is same as previous...
        IF box.s(r) = 2 AND box.v(r) = box.v(nums(rc)) THEN
            'store this box value in nums too
            nums(rc + 1) = r
            'increase how many so far
            rc = rc + 1
        ELSE
            'bot same, so reset

            IF rdone = 0 THEN
                'no more, so start over from here
                ERASE nums
                REDIM nums(9)
                rc = 1: nums(1) = r
            ELSE
                'no more can exists on line
                EXIT FOR
            END IF
        END IF

        'if there was 5 or more found
        IF rc >= 5 THEN rdone = 1

    NEXT

    'if group was found, clear
    IF rdone = 1 THEN
        PLAY "mbl32o3cdefga"
        'step through nums values
        FOR d = 1 TO 9
            IF nums(d) <> 0 THEN

                score = score + 55 '55 points per ball

                x = box.x(nums(d)): y = box.y(nums(d))
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(255, 255, 255), BF
                _DELAY .025: _DISPLAY
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(64, 64, 64), BF
                _DELAY .025: _DISPLAY
                checks(nums(d)) = 0 'mark checking array
            END IF
        NEXT
    END IF

    ERASE nums

END SUB

SUB CheckCol (num)

    'space to hold box nums to clear
    REDIM nums(9)

    'found some to clear flag
    rdone = 0

    'set place and num
    rc = 1
    nums(1) = num

    'step through the boxes

    FOR r = (num + 9) TO (rows * cols) STEP 9

        'if this box is same as previous...
        IF box.s(r) = 2 AND box.v(r) = box.v(nums(rc)) THEN
            'store this box value in nums too
            nums(rc + 1) = r
            'increase how many so far
            rc = rc + 1
        ELSE
            'bot same, so reset

            IF rdone = 0 THEN
                'no more, so start over from here
                ERASE nums
                REDIM nums(9)
                rc = 1: nums(1) = r
            ELSE
                'no more can exists on line
                EXIT FOR
            END IF
        END IF

        'if there was 5 or more found
        IF rc >= 5 THEN rdone = 1

    NEXT

    'if group was found, clear
    IF rdone = 1 THEN
        PLAY "mbl32o3cdefga"
        'step through nums values
        FOR d = 1 TO 9
            IF nums(d) <> 0 THEN
                score = score + 55 'add to score
                x = box.x(nums(d)): y = box.y(nums(d))
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(255, 255, 255), BF
                _DELAY .025: _DISPLAY
                LINE (x + 2, y + 2)-(x + size - 2, y + size - 2), _RGB(64, 64, 64), BF
                _DELAY .025: _DISPLAY
                checks(nums(d)) = 0 'mark checking array
            END IF
        NEXT
    END IF

    ERASE nums

END SUB


SUB UpdateBoard

    CLS , _RGB(96, 96, 96)

    PPRINT 20 * df, 14 * df, 15 * df, _RGB(255, 255, 0), 0, "SCORE:" + LTRIM$(STR$(score))
    IF score >= hiscore THEN
        hiscore = score
        SaveScore
    END IF
    PPRINT 475 * df, 14 * df, 15 * df, _RGB(255, 150, 150), 0, "HI:" + LTRIM$(STR$(hiscore))

    PPRINT 222 * df, 12 * df, 24 * df, _RGB(1, 1, 1), 0, "-=MAKE5=-"
    PPRINT 220 * df, 10 * df, 24 * df, _RGB(255, 255, 255), 0, "-=MAKE5=-"

    '=== draw board based on box values
    bc = 1 'counter
    FOR cl = 1 TO cols
        FOR ro = 1 TO rows
            '=== if empty box
            IF box.v(bc) = 0 THEN
                LINE (box.x(bc) + 2, box.y(bc) + 2)-(box.x(bc) + size - 2, box.y(bc) + size - 2), _RGB(32, 32, 32), BF
            ELSE
                LINE (box.x(bc) + 2, box.y(bc) + 2)-(box.x(bc) + size - 2, box.y(bc) + size - 2), _RGB(32, 32, 32), BF
                '=== draw color ball
                x2 = box.x(bc) + (size / 2) 'find middle of box
                y2 = box.y(bc) + (size / 2)
                IF box.s(bc) = 1 THEN sz = size / 4 ELSE sz = size / 2
                SELECT CASE box.v(bc)
                    CASE IS = 1: r = 255: g = 64: b = 64 'red
                    CASE IS = 2: r = 64: g = 232: b = 64 'green
                    CASE IS = 3: r = 64: g = 64: b = 255 'blue
                    CASE IS = 4: r = 255: g = 255: b = 0 'yellow
                    CASE IS = 5: r = 255: g = 255: b = 255 'white
                END SELECT
                'draw colored balls
                FOR s = 1 TO (sz - 4) STEP .3
                    CIRCLE (x2, y2), s, _RGB(r, g, b)
                    r = r - 1: g = g - 1: b = b - 1
                NEXT

            END IF
            bc = bc + 1
        NEXT
    NEXT

    'overlay a very faint QB64-PE icon on board
    _SETALPHA 16, , -11: _PUTIMAGE (0, 50 * df)-(_WIDTH, _HEIGHT), -11

    _DISPLAY
    _ICON _DISPLAY 'update app icon on taskbar
END SUB

SUB MakeNewBalls (num, ballsize)
    'Assign 3 new balls
    newball = 0
    DO
        c = INT((RND * (cols * rows)) + 1)
        IF box.v(c) = 0 THEN
            box.v(c) = INT((RND * 5) + 1)
            box.s(c) = ballsize
            newball = newball + 1
        END IF
        IF newball = num THEN EXIT DO
    LOOP
END SUB

SUB PPRINT (x, y, size, clr&, trans&, text$)
    orig& = _DEST
    bit = 32: IF _PIXELSIZE(0) = 1 THEN bit = 256
    FOR t = 0 TO LEN(text$) - 1
        pprintimg& = _NEWIMAGE(16, 16, bit)
        _DEST pprintimg&
        CLS , trans&: COLOR clr&
        PRINT MID$(text$, t + 1, 1);
        _CLEARCOLOR _RGB(0, 0, 0), pprintimg&
        _DEST orig&
        x1 = x + (t * size): x2 = x1 + size
        y1 = y: y2 = y + size
        _PUTIMAGE (x1 - (size / 2), y1)-(x2, y2 + (size / 3)), pprintimg&
        _FREEIMAGE pprintimg&
    NEXT
END SUB

SUB SaveScore
    'Out with the old
    IF _FILEEXISTS("make5.dat") THEN KILL "make5.dat"
    'In with the new
    scr = FREEFILE
    OPEN "make5.dat" FOR OUTPUT AS #scr
    hi$ = MKL$(hiscore)
    PRINT #scr, hi$;
    CLOSE #scr
END SUB

   

Print this item

  BAM Debugging features
Posted by: CharlieJV - 11-20-2022, 11:16 PM - Forum: QBJS, BAM, and Other BASICs - Replies (1)

Until I get around to building in some substantial features, the following took me all of a half hour to setup just to have something useful:

   

Print this item