Manual Pyramid Peg Game
#1
This is a computer version of a very old wooden peg pyramid game. Everything is manual so please read the directions at the start page. If you have any questions, please ask. I would also like comments. I thought about making it non-manual with it detecting jumps, etc. but it would add a lot of programming time and I thought that it's good enough the way it is, just like the original. I think I saw someone make this, or something like this many months ago on the old forum, but I wanted to make my own version. I also know there's a lot of code here and better programmers could have made it a lot less, but I just kept it simple. Smile 

I hope you have fun with it!


[Image: Manual-Pyramid-Peg-Game-by-Sierra-Ken.jpg]




Code: (Select All)
'Manual Pyramid Peg Game - by SierraKen"
'Made on August 7, 2022.
'This game only has the pegs and board, you have to use the mouse to control everything.


Screen _NewImage(600, 600, 32)
_Title "Manual Pyramid Peg Game - by SierraKen - Space Bar Resets - Esc Quits"

start:
_Limit 20
Cls
Print "                            Manual Pyramid Peg Game"
Print: Print
Print "                                 By SierraKen"
Print: Print
Print "This game only has the pegs and board, you have to use the mouse to"
Print "control everything."
Print
Print "How To Play:"
Print "1. First remove one peg anywhere on the board."
Print "2. Then jump over an existing peg, using another existing peg,"
Print "   onto an empty hole."
Print "3. First click the peg that you want to jump with to delete it"
Print "   from that first hole."
Print "4. Then click the empty hole you are jumping into to add the peg."
Print "5. And then make sure and click the peg you jumped over to delete it."
Print "6. Keep doing this until you cannot jump over any others."
Print "7. To win the game you need to only have one peg left."
Print "8. You can only go in a straight line and cannot skip over other"
Print "   holes or pegs."
Print "9. Space Bar resets the game."
Print "10. Esc ends the program."
Print: Print: Print
Print "                 Click This Screen With Your Mouse To Start."
Do
    While _MouseInput: Wend
    mouseLeftButton = _MouseButton(1)
    If mouseLeftButton Then
        Clear_MB 1
        GoTo begin:
    End If
Loop

begin:
cl = 255
h1 = 0: h2 = 0: h3 = 0: h4 = 0: h5 = 0: h6 = 0: h7 = 0: h8 = 0
h9 = 0: h10 = 0: h11 = 0: h12 = 0: h13 = 0: h14 = 0: h15 = 0

Cls
For yy = 0 To 600
    cc = cc + .2
    Line (0, yy)-(600, yy), _RGB32(0, 0, cc)
Next yy
cc = 0

Line (300, 50)-(50, 550), _RGB32(200, 84, 0)
Line (300, 50)-(550, 550), _RGB32(200, 84, 0)
Line (50, 550)-(550, 550), _RGB32(200, 84, 0)

Paint (300, 52), _RGB32(200, 84, 0)

'Pegs

'Bottom Holes Left To Right.
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (150, 475), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (225, 475), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (300, 475), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (375, 475), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (450, 475), sz, _RGB32(cl, cl, cl)
Next sz

'Second Level Holes Left To Right
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (185, 400), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (260, 400), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (335, 400), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (410, 400), sz, _RGB32(cl, cl, cl)
Next sz

'Third Level Holes Left To Right
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (225, 325), sz, _RGB32(cl, cl, cl)
Next sz
cl = 244
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (300, 325), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (375, 325), sz, _RGB32(cl, cl, cl)
Next sz

'Fourth Level Holes Left To Right
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (265, 250), sz, _RGB32(cl, cl, cl)
Next sz
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (340, 250), sz, _RGB32(cl, cl, cl)
Next sz

'Top Level Hole
cl = 255
For sz = .25 To 15 Step .1
    cl = cl - 1
    Circle (300, 175), sz, _RGB32(cl, cl, cl)
Next sz


Do
    _Limit 20
    a$ = InKey$
    If a$ = Chr$(27) Then End
    If a$ = " " Then GoTo start:
    While _MouseInput: Wend
    x = _MouseX
    y = _MouseY
    mouseLeftButton = _MouseButton(1)
    If mouseLeftButton Then
        Clear_MB 1

        'First Bottom Level

        If x > 135 And x < 165 And y > 460 And y < 490 And h1 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (150, 475), sz, _RGB32(100, 50, 50)
            Next sz
            h1 = 1
            x = -100
            y = -100
            cl = 255
        End If

        If x > 135 And x < 165 And y > 460 And y < 490 And h1 = 1 Then
            cl = 255
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (150, 475), sz, _RGB32(cl, cl, cl)
            Next sz
            h1 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 210 And x < 240 And y > 460 And y < 490 And h2 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (225, 475), sz, _RGB32(105, 50, 50)
            Next sz
            h2 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 210 And x < 240 And y > 460 And y < 490 And h2 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (225, 475), sz, _RGB32(cl, cl, cl)
            Next sz
            h2 = 0
            x = -100
            y = -100
            cl = 255
        End If


        If x > 285 And x < 315 And y > 460 And y < 490 And h3 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (300, 475), sz, _RGB32(105, 50, 50)
            Next sz
            h3 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 285 And x < 315 And y > 460 And y < 490 And h3 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (300, 475), sz, _RGB32(cl, cl, cl)
            Next sz
            h3 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 360 And x < 390 And y > 460 And y < 490 And h4 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (375, 475), sz, _RGB32(105, 50, 50)
            Next sz
            h4 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 260 And x < 390 And y > 460 And y < 490 And h4 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (375, 475), sz, _RGB32(cl, cl, cl)
            Next sz
            h4 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 435 And x < 465 And y > 460 And y < 490 And h5 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (450, 475), sz, _RGB32(105, 50, 50)
            Next sz
            h5 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 435 And x < 465 And y > 460 And y < 490 And h5 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (450, 475), sz, _RGB32(cl, cl, cl)
            Next sz
            h5 = 0
            x = -100
            y = -100
            cl = 255
        End If

        'Second Level

        If x > 170 And x < 200 And y > 385 And y < 415 And h6 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (185, 400), sz, _RGB32(105, 50, 50)
            Next sz
            h6 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 170 And x < 200 And y > 385 And y < 415 And h6 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (185, 400), sz, _RGB32(cl, cl, cl)
            Next sz
            h6 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 245 And x < 275 And y > 385 And y < 415 And h7 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (260, 400), sz, _RGB32(105, 50, 50)
            Next sz
            h7 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 245 And x < 275 And y > 385 And y < 415 And h7 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (260, 400), sz, _RGB32(cl, cl, cl)
            Next sz
            h7 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 320 And x < 350 And y > 385 And y < 415 And h8 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (335, 400), sz, _RGB32(105, 50, 50)
            Next sz
            h8 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 320 And x < 350 And y > 385 And y < 415 And h8 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (335, 400), sz, _RGB32(cl, cl, cl)
            Next sz
            h8 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 395 And x < 425 And y > 385 And y < 415 And h9 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (410, 400), sz, _RGB32(105, 50, 50)
            Next sz
            h9 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 395 And x < 425 And y > 385 And y < 415 And h9 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (410, 400), sz, _RGB32(cl, cl, cl)
            Next sz
            h9 = 0
            x = -100
            y = -100
            cl = 255
        End If

        'Third Level

        If x > 210 And x < 240 And y > 310 And y < 340 And h10 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (225, 325), sz, _RGB32(105, 50, 50)
            Next sz
            h10 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 210 And x < 240 And y > 310 And y < 340 And h10 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (225, 325), sz, _RGB32(cl, cl, cl)
            Next sz
            h10 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 285 And x < 315 And y > 310 And y < 340 And h11 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (300, 325), sz, _RGB32(105, 50, 50)
            Next sz
            h11 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 285 And x < 315 And y > 310 And y < 340 And h11 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (300, 325), sz, _RGB32(cl, cl, cl)
            Next sz
            h11 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 360 And x < 390 And y > 310 And y < 340 And h12 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (375, 325), sz, _RGB32(105, 50, 50)
            Next sz
            h12 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 360 And x < 390 And y > 310 And y < 340 And h12 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (375, 325), sz, _RGB32(cl, cl, cl)
            Next sz
            h12 = 0
            x = -100
            y = -100
            cl = 255
        End If

        'Fourth Level

        If x > 250 And x < 280 And y > 235 And y < 265 And h13 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (265, 250), sz, _RGB32(105, 50, 50)
            Next sz
            h13 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 250 And x < 280 And y > 235 And y < 280 And h13 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (265, 250), sz, _RGB32(cl, cl, cl)
            Next sz
            h13 = 0
            x = -100
            y = -100
            cl = 255
        End If

        If x > 325 And x < 355 And y > 235 And y < 265 And h14 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (340, 250), sz, _RGB32(105, 50, 50)
            Next sz
            h14 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 325 And x < 355 And y > 235 And y < 280 And h14 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (340, 250), sz, _RGB32(cl, cl, cl)
            Next sz
            h14 = 0
            x = -100
            y = -100
            cl = 255
        End If

        'Top Hole

        If x > 285 And x < 315 And y > 160 And y < 190 And h15 = 0 Then
            For sz = .25 To 15 Step .1
                Circle (300, 175), sz, _RGB32(105, 50, 50)
            Next sz
            h15 = 1
            x = -100
            y = -100
            cl = 255
        End If
        If x > 285 And x < 315 And y > 160 And y < 190 And h15 = 1 Then
            For sz = .25 To 15 Step .1
                cl = cl - 1
                Circle (300, 175), sz, _RGB32(cl, cl, cl)
            Next sz
            h15 = 0
            x = -100
            y = -100
            cl = 255
        End If

    End If
Loop

Sub Clear_MB (var As Integer)

    Do Until Not _MouseButton(var)
        While _MouseInput: Wend
    Loop

End Sub 'Clear_MB
Reply
#2
https://staging.qb64phoenix.com/showthread.php?tid=422

EEG-no-rah-moose ROFLMAO! Kept being called that by the game, and "smart" only once or twice.
Reply
#3
Amazing version Dav made, thanks for showing me.
Reply
#4
It is an accomplishment to make the pyramid arrangement of balls and making the triangle fill unless you just used paint, oh I bet... ;-))

Oh hey you polled the mouse correctly and even used OldMoses Mouse Clear routine.
b = b + ...
Reply
#5
Smile Thanks B+. Yep good ol' Paint works almost every time. And if it doesn't, good ol' COPYIMAGE and PUTIMAGE works too. I worked on it a bit more today but I got into way too many problems. Most likely I'm stopping here. Smile
Reply




Users browsing this thread: 2 Guest(s)