QB64 Phoenix Edition
TriPegs - Classic triangle peg jumping game - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: Dav (https://qb64phoenix.com/forum/forumdisplay.php?fid=34)
+---- Thread: TriPegs - Classic triangle peg jumping game (/showthread.php?tid=422)



TriPegs - Classic triangle peg jumping game - Dav - 05-16-2022

TriPegs is a clone of the wooden triangle peg jumping puzzle you often see on the tables at the crackle barrel restaurants here the US.  It's a very simple puzzle to play, you just jump over the pegs, removing the peg you jump over.  The goal is to leave only one peg on the board, which gives you the genius rating.  Have fun.

- Dav


.zip   tripegs-src.zip (Size: 146.46 KB / Downloads: 99)

   


RE: TriPegs - Classic triangle peg jumping game - SierraKen - 08-08-2022

This is incredible Dav. I made a 100% manual version today. Good job. https://qb64phoenix.com/forum/showthread.php?tid=747


RE: TriPegs - Classic triangle peg jumping game - johnno56 - 08-09-2022

This is an evil game! Only once did I receive a 'Genius' and a 'smart'. I had to endure, on many occasions, having my game playing skills berated! To top it off... The game never started in the same position... Evil I tell you. Evil!

Looking forward to your next project!


RE: TriPegs - Classic triangle peg jumping game - PhilOfPerth - 08-10-2022

Great game, Dav (and SierraKen)!
Maybe one day I'll progress above the "DUMB!" stage.


RE: TriPegs - Classic triangle peg jumping game - johnno56 - 08-10-2022

Dav. Quick question:

Line #82 uses the '_COPYIMAGE()' command. I looked it up to see what it does but I do not know 'why' it was used. A little enlightenment if you would be so kind.... Thank you.

J


RE: TriPegs - Classic triangle peg jumping game - Dav - 08-10-2022

Thanks, @SierraKen, @PhilOfPerth, @johnno56!  Glad you're enjoying it.  I'm still usually an EG-NO-RA-MOOSE playing this.

johnno56, about the _COPYIMAGE call, what it's doing there is taking a snapshot of the screen to use (minus the peg being moved) while dragging that selected peg around the screen.  In the peg dragging DO/LOOP, I first _PUTIMAGE that snapshot (Line #90), then _PUTIMAGE the selected peg after it (line #91).  It keeps the board clean, just see the board with a single moving peg image.   Without using that _COPYIMAGE snapshot, the board will fill up with many moving peg images as you drag it around.

It's safe to comment out line #82 and run it to see what will happen without it, the screen will fill up with pegs.

- Dav


RE: TriPegs - Classic triangle peg jumping game - johnno56 - 08-10-2022

Applied your suggestion. Your explanation and advice demonstrated the 'why'. Thank you Dav. Much appreciated.