Author Topic: TriPegs - classic wooden triangle peg puzzle  (Read 3853 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
TriPegs - classic wooden triangle peg puzzle
« on: April 20, 2020, 10:46:34 pm »
Another day without a job, so I made another puzzle game. 

If you've ever eaten at the crackle barrel in the US, you've probably seen and played the little peg jumping puzzle game on the table while waiting for your food.  Here's a clone made in QB64.  Simple to play, just jump over the pegs, leaving only one peg on the board.

Have fun.

- Dav

 
tripegs.jpg


Download source -->

« Last Edit: April 20, 2020, 11:20:18 pm by Dav »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: TriPegs - classic wooden triangle peg puzzle
« Reply #1 on: April 21, 2020, 02:29:04 pm »
Very nice game! Definitely an adept in the game section!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: TriPegs - classic wooden triangle peg puzzle
« Reply #2 on: April 21, 2020, 04:17:11 pm »
Yeah warm up with this and then go for Dav's PegSolitaire (or Chinese Checkers) :)

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: TriPegs - classic wooden triangle peg puzzle
« Reply #3 on: April 21, 2020, 04:48:32 pm »
Pretty cool clone, only now I have a hankerin' for a plate of meatloaf...

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: TriPegs - classic wooden triangle peg puzzle
« Reply #4 on: April 21, 2020, 05:56:57 pm »
I asked the wife to cook a pot roast tonight. While the heavenly smell of that home cooked meal wafts through the house I'm going to play this game in front of the fireplace and pretend I'm sitting at Cracker Barrel. mmmmmmmmmmm
In order to understand recursion, one must first understand recursion.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: TriPegs - classic wooden triangle peg puzzle
« Reply #5 on: April 21, 2020, 06:18:30 pm »
Lucky guys with your meat cooking wives. Mine went vegetarian on me. No meat anymore. She's cooking up mushroom/kimchi  sir fry right now.  And since we're in shelter in place mode, I can't make my emergency hamburger runs without her knowing it.

I should have tested this game on my slower Thinkpad R61 before uploading.  On that laptop the peg dragging is very slow, makes the game play horrible.  So, I've made an adjustment that fixes that and shouldn't hurt game play on faster computers.

On line #87 you should see this,,

Code: QB64: [Select]
  1.                         'show selected peg in hand, over backgraound
  2.                         _PUTIMAGE (0, 0), back&
  3.                         _PUTIMAGE (_MOUSEX - 25, _MOUSEY - 20), peg2&: _DISPLAY
  4.  

Change it to read like this, and it will draw less often...

Code: QB64: [Select]
  1.                         IF INT(RND * 4) = 1 THEN
  2.                             'show selected peg in hand, over backgraound
  3.                             _PUTIMAGE (0, 0), back&
  4.                             _PUTIMAGE (_MOUSEX - 25, _MOUSEY - 20), peg2&: _DISPLAY
  5.                         END IF
  6.  

Glad everyone like the game.  I had fun making it. 

- Dav