Post Reply 
(HP12C) Leapfrog puzzle
04-06-2020, 08:45 PM
Post: #1
(HP12C) Leapfrog puzzle
(N.B. : in the good forum ! thanks, SlideRule)

Leapfrog way
(or how to drive 2 groups of 3 sheep, face to face on a very narrow steep mountain trail !)

The original program had been written for HP67, HP41C and TI59, and came on year 1980 !
It was published by Jean-Jacques Dhenin in the magazine "Jeux et Stratégie" #1, under the title "Jouez à saute-mouton".

So, I have borrowed the idea from this fantastic publication.
However, I propose here a version of mine for the HP12C, without index register and other indirect memories.

This game is rather a problem to solve or a puzzle to complete.

2 groups of 3 sheep (frogs in English) are face to face.
There is no way for a group to go back or to cross the other group or to pass next to each other without to leapfrog.
Their only solution is to jump over the animals in front of them, again and again, until they pass the whole group.


The starting position follows from this presentation :

_→ → →_← ← ←_ on the way
_5 5 5 _ 2 2 2_ in the program

#1 2 3 4 5 6 7 list of the places


These are the rules :

- an animal do not leapfrog a animal of its own group
- an animal of a group may jump over the animal immediately in front of him, and from the other group, only if it has free space just behind
- an animal is not authorized to go back or to reverse


The puzzle is completed if all the animals of the 2 groups have free way to progress forward :

_← ← ←_→ → →_ on the way
_2 2 2 _ 5 5 5_ in the program


Use of the program :

. store 10 in PMT
. store 0,5550222 in PV
. store 0,2220555 in FV
. g GTO 00 and R/S
. the display is 0,55502220 and waits a move from 1 to 7
--> at first you can just input 3 or 5 as correct move and press R/S
. I choose 3 R/S and the HP12C returns 1,55052220 after this 1st step
--> at this time there is 2 correct moves : 2 (moving 5 before 0 on display) or 5 (moving 2 just in front of 5 by leapfrog)
. and so on with 2,50552220 or 2,5525022 on display !


Warning about input boundaries :
. the program aborts a non authorized move by displaying without changes the last position known
. but the program does not verify if a 5 species is about to come on place # 8, or if a 2 species arrives on place # 0...


Attached File(s)
.pdf  HP12C - Leapfrog way - lmaN for the MoHPC - 20200406.pdf (Size: 33.02 KB / Downloads: 8)
Find all posts by this user
Quote this message in a reply
04-07-2020, 12:33 AM
Post: #2
RE: (HP12C) Leapfrog puzzle
The original is on pages 54-56, sur votre calculatrice programmable, jeux et stratégie n°1 (1980)

"En attendant qu'un large public dispose d’un tel matériel, nous vous présenterons dans cette rubrique des programmes de jeux pour des calculatrices de poche évoluées. Nous avons choisi pour l'instant des machines « haut de gamme », la Hewlett-Packard HP67 et la Texas Instruments TI59. Encore chères, de 1 500 à 2 000 francs, elles offrent en effet de très larges possibilités et notamment des cartes magnétiques qui permettent de se constituer une bibliothèque de programmes.

Nous vous proposons même ici un programme pour la dernière née de Hewlett-Packard, la HP4IC qui présente déjà de nombreux avantages propres aux ordinateurs dont une imprimante et un affichage alpha-numérique (lettres et chiffres).

A présent, à vous de jouer. Nous espérons que vous deviendrez vite des experts en « ludotique » et nous attendons avec impatience vos remarques... et vos programmes."

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
04-10-2020, 01:37 PM
Post: #3
RE: (HP12C) Leapfrog puzzle
The same listing for HP12C with included start
(Thank you for you practical note, rprosperi)


Attached File(s)
.pdf  HP12C - Leapfrog way + example - lmaN for the MoHPC - 20200410.pdf (Size: 36.22 KB / Downloads: 5)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)