### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Leap Frogs Logic Game now with Variable Size  (Read 4450 times)

#### Boleeman

• Hero Member
• Posts: 650
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #15 on: February 01, 2024, 08:45:29 am »
Sorry KodeZwerg, I added to new code to the source while hovering over and playing with 4 other graphics related Lazarus projects until late at night (hmm ....early morning = 1 am) and realized next morning after your reply that your code was in fact the move types coding I was interested in. Kinda of a brain fuzz due to too many fun things to play around with ("a case of too much candy all at once").  I will definitely try out your new suggestions.

Been having fun with the Lazarus graphics and trying out new things (stepping out of my comfort zone).
Also been trying out Code Typhon and the Lazarus converter, just to see the difference between the 2 Pascal Programming Environments.

Updated: Added the following for types of moves

Code: Pascal  [Select][+][-]
1.   if (abs(Current - Empty) = 1) then  how := 'Slided from ';
2.   if (abs(Current - Empty) > 1) then  how := 'Jumped from ';
3.
4.   Memo1.Lines.AddStrings(how + IntToStr(Current) + ' to ' + IntToStr(Empty) );

Slided from 1 to 2
Jumped from 3 to 1
Slided from 4 to 3
Jumped from 2 to 4
Jumped from 0 to 2
Slided from 1 to 0
Jumped from 3 to 1
Slided from 2 to 3

Now have jumps and slides. Yay. Hipee. Horray!

Got me thinking, how to replay the moves or do the solution (going back the other way). More to play around with.

As always, many thanks KodeZwerg.

« Last Edit: February 01, 2024, 10:28:14 am by Boleeman »

#### KodeZwerg

• Hero Member
• Posts: 2269
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #16 on: February 01, 2024, 12:54:36 pm »
I am unsure if it is for use of you, but I've slightly updated a little more.
- undo possibility
- 3 different displays for clicks moves and undo
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

#### KodeZwerg

• Hero Member
• Posts: 2269
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #17 on: February 01, 2024, 04:09:53 pm »

//updated "video" to a full length version

Replay does only show the valid moves, every undo action is not recorded.
If you also want that, consider creating a second array of TMoves that capture everything.
« Last Edit: February 01, 2024, 04:29:47 pm by KodeZwerg »
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

#### KodeZwerg

• Hero Member
• Posts: 2269
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #18 on: February 01, 2024, 11:48:52 pm »
If no bugs reported, this is my final version.
Added a CheckLost method to tell that user needs to undo or begin a new game.

Enjoy the puzzle at high levels!
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

#### Boleeman

• Hero Member
• Posts: 650
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #19 on: February 03, 2024, 09:51:09 am »
KodeZwerg, once again a great many thanks.

I was always interested in how to do undo and redo. I will needed to look at your code carefully.

Take care buddy.

Here in Australia we are having a heat wave today.
Kind of crazy weather, considering December and January was cold/rainy on some of the days.
Usually it is always a heat wave.

#### Boleeman

• Hero Member
• Posts: 650
##### Re: Leap Frogs Logic Game now with Variable Size
« Reply #20 on: February 03, 2024, 09:33:34 pm »
For those programmers that might be interested, Garry Darby from the Delphi for Fun Web Site has made a version of the frogs game that uses graphs (depth first and breadth first searches of graphs).

It uses his own maths library, which you can have them in the same folder when compiling. I tried to convert this to Lazarus, but that library brought up some errors which I could not resolve.

Attached is the Delphi source code and a screen shot.

I like the way different people have used different approaches for this Logic Game.

Enjoy.

« Last Edit: February 03, 2024, 09:36:24 pm by Boleeman »