Post Reply 
(HP12C) Always a number further !
04-09-2020, 07:25 PM (This post was last modified: 04-09-2020 07:29 PM by Nihotte(lma).)
Post: #1
(HP12C) Always a number further !
Always a number further !
This time, I propose here a program for the HP12C to train you to memorize numbers...

I first saw the idea in a French magazine dedicated to pocket calculators.
I think of «l'Ordinateur de poche» #3 published on the end of the year 1981 !
The title of the original article was «Avez-vous une mémoire aussi bonne que votre xxxpoche ?»
The program was written for TI-58 (TI-59) and was published by Denis Alexandre.

In my adaptation, the program runs until you make a mistake in entering one of the numbers from the list expected by the HP12C.
It does not need a lot of storage memories : no number has to be saved for a long time.
Each of them is regenerated at the right time.

This is the program :

Each turn, the calculator adds a new number at the end of the previous list of numbers.
Each time, these are two phases :
- at first, the HP12C displays, one after one, all the numbers of the current list.
- then, the calculator waits for you to successively restore the numbers without errors and in the same order you saw them.
Next, the first phase come back again, with a new last number !
And in the second phase, again, HP12C controls all you bring back.
So, at the beginning, there is only one number to bring back, and then two numbers, and the next turn three numbers, and so on, until you fail.

N.B. : the listing of the program gives a detailed example


Attached File(s)
.pdf  HP12C - Always a number further - lmaN for the MoHPC - 20200409.pdf (Size: 32.05 KB / Downloads: 25)
Find all posts by this user
Quote this message in a reply
04-09-2020, 11:39 PM
Post: #2
RE: (HP12C) Always a number further !
Can I make a suggestion for the nice programs you post here?

Please include the description that you write in the Forum post in the PDF document.

People will download the PDF now when they see it, but then when they decide to read it again later, the background and instructions are already in the PDF file, so no need to go back and fine the original post to read how to use the program.

Thanks for sharing these programs here. Smile

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-10-2020, 12:10 AM
Post: #3
RE: (HP12C) Always a number further !
Try Avez-vous une mémoire aussi bonne que votre xxxpoche ?, N"3 L'OROINATEUR DE POCHE {Pages 19-20}.

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
04-10-2020, 02:25 AM
Post: #4
RE: (HP12C) Always a number further !
(04-10-2020 12:10 AM)SlideRule Wrote:  Try Avez-vous une mémoire aussi bonne que votre xxxpoche ?, N"3 L'OROINATEUR DE POCHE {Pages 19-20}.

BEST!
SlideRule

Mais, Je ne parles pas Francais... Sad

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
04-10-2020, 08:35 AM (This post was last modified: 04-10-2020 08:43 AM by Nihotte(lma).)
Post: #5
RE: (HP12C) Always a number further !
Thanks for your practical suggestions, rprosperi !
Thanks for your link too, SlideRule !

For your last remark, rprosperi, I can explain you that the original program starts with asking how many items the user wants to memorize. The calculator first gives the list and then the user key in back the numbers, one after one. Each time, the user makes a mistake, the program pops up an alert but it continues until all the list is over.
At the end, the user gets a good or bad grade !
Find all posts by this user
Quote this message in a reply
09-01-2024, 05:01 PM
Post: #6
RE: (HP12C) Always a number further !
(04-10-2020 08:35 AM)Nihotte(lma) Wrote:  Thanks for your practical suggestions, rprosperi !
Thanks for your link too, SlideRule !

For your last remark, rprosperi, I can explain you that the original program starts with asking how many items the user wants to memorize. The calculator first gives the list and then the user key in back the numbers, one after one. Each time, the user makes a mistake, the program pops up an alert but it continues until all the list is over.
At the end, the user gets a good or bad grade !


Attached File(s)
.pdf  HP12C - Always a number further - documented - lmaN for the MoHPC - 20240901.pdf (Size: 80.43 KB / Downloads: 21)
Find all posts by this user
Quote this message in a reply
09-02-2024, 12:49 PM
Post: #7
RE: (HP12C) Always a number further !
(04-09-2020 07:25 PM)Nihotte(lma) Wrote:  In my adaptation, the program runs until you make a mistake in entering one of the numbers from the list expected by the HP12C.
It does not need a lot of storage memories : no number has to be saved for a long time.
Each of them is regenerated at the right time.

Thanks Nihotte for this clever program.

Indeed, the HP-12C does not offer any subroutine, register table, indirect addressing, random number generator function, flag, sophisticated comparison test, etc.
But all these pitfalls did not prevent you from producing a functional game.

While clearly the program for Ti58/59 that inspired this game uses a register table, indirections and subroutines, Nihotte's code must be clever to achieve the same result in a different way. I am more used to programming my HP-15C and reading the code for TI58/59 I imagined it adapted using flags, subroutines or matrices. But on the HP-12C, it's a different story!

I love how the number table is avoided by using the pseudo-random number generator in sequences. I understand better what 'Each of them is generated at the right time' means.

Bravo.
And thank you for sharing.
Find all posts by this user
Quote this message in a reply
09-06-2024, 09:08 PM
Post: #8
RE: (HP12C) Always a number further !

Hi C.Ret,

Thank you very much for your great post on this thread.
That made me happy and for the sake of your energizing words, I wanted to bring you a response.

But it's so true that it's much simpler and more logical to program an HP15C or an HP41C!!

This reminds me of the day when (then a student in Lorraine in France), I went to an HP reseller in Nancy (Meurthe-et-Moselle).
Probably to ask him for recent documentation and also to find out if he had any interesting offers.

He suggested an HP12C to me on which there was probably a back-to-school offer or something similar.
I asked him a little mockingly - dismissively? - if it was possible to write a Mastermind program on this machine!?

I remember him thinking for several seconds and saying no.
Perhaps also by imagining the extent of the journey he would have to make with me if he answered yes. Or again, very regretfully: I don't know...

He answered a simple no.
But he told me about the strong points of this little machine with the calculations on dates, the calculation facilities for loans:
it would be useful to me later, he explained to me.
And then also the ease with which we change the display format: f 2 or f 4 to display 2 or 4 decimal places.

Well, at the time, I remained very closed to his offer.
Just think: a machine that didn't even have all the logarithms on the keyboard and especially not the useful probability functions to a computer science student
who had all this on the program in Maths class at university.
Not to mention the keyboard left with so many unused keys with sometimes only one main function instead of the 3 possible taking into account the presence
of the function keys f and g!!

Since the start of my studies in high school, I was immersed in the use of the HP34C and HP15C thanks to my dad who had very early on bet on
the reverse Polish notation and even from the release of the HP35. More of a scientific universe, then! Trigonometric functions had no secrets for him!

But, I digress. The subject is rather the HP12C.
What could be more natural than to compose a program on a machine which allows its user to have access to all the concepts advanced computing that you mentioned?
At the same time, it’s much more reassuring!

Finally, if I did everything to get away, it was the HP12C that caught up with me.
Not right away.
First the HP27S and its other way of managing formulas and the full range of its functions.
Then, the HP17Bii, with its sleek keyboard and its air of "not touching it".
But we can't be someone else.
Perhaps I was too accustomed and attached to the 10 series HP calculators (15 and 16, therefore) not to give in to the temptation of acquiring an HP12C on ebay?
This happened more recently, only a few years ago.
The contact I had with this HP reseller had, so to speak, not completely left me either.

At the beginning, I transcribed some very simple little programs to test my machine:
- the Czech conjecture,
- a simple random number generator,
- the 'mysterious number' game, ...
And then, I took it with me to work because it is very practical for simple calculations, calculations of evolution or proportions,
price reductions, cost price calculations, ... It's my daily life to respond to stores managers who contact me on the support hotline!

One thing led to another, I wanted to adapt programs that were denser and richer in needs so that I could still have them with me when I took my calculator!!
So, little by little, I was able to transcribe other programs for this little machine that was ultimately not so poor in resources.
I have already found some little treasures of creation from other members of the MoHPC!!

Afterwards, I wanted to transcribe my biorhythms calculation program: compared to an HP11C or an HP15C, I gained steps about the calculation on dates!
But for the sine calculations, everything had to be redone...
There, it was Valentin Albillo's programs that helped me succeed: I borrowed his routines.
Then it was the turn of the Yam's program and then that of Mastermind.
(For the record, I first had the idea of ​​using the value of the dice as a power of 10 to display ordered results in Yam's program.
It was then this same method that I used to be able to compare the codes on the Mastermind.
This progress allowed me to supercharge the comparison of the code proposed by the player with the one he must discover:
I don't think so having written a faster program on this subject in using digital secret codes!)

Well yes! It was therefore possible to write a Mastermind program for this great little calculator.
At the time, I hadn't yet progressed enough to know how to do it or even find the way when I visited this Hewlett-Packard reseller in his store!
In fact, he really didn't waste his time and did me a favor that day!

Looking back, I tell myself that when you take something to heart, the difficulty is not so insurmountable.
And to plagiarize the words of Valentin Albillo: long live the HP 12C!

For my part, I am very happy to be able to publish such programs here. On the one hand, since they exist,
to share them with our community of enthusiasts and, on the other hand, to participate a little in the deconfinement
of the HP12C regarding its role as a powerful and wise financial calculator.

It practically has the most energetic 100 steps in pocket computing!

Keep you safe!

Laurent
[/size][/font]
Find all posts by this user
Quote this message in a reply
09-07-2024, 09:32 AM (This post was last modified: 09-10-2024 06:13 PM by C.Ret.)
Post: #9
RE: (HP12C) Always a number further !
Merci Laurent pour cette longue réponse.
Me me rends compte que nous sommes voisins !

Thank you Nihotte(lma) for this long answer.
I realize that we are neighbors and both from the north of Lorraine!

In order to illustrate your words, I share a code for my HP-15C based on your algorithm...
Of course, there are a lot of other ways of doing it. But the idea is to give an overview of the differences in the programming style between models HP-12C and HP-15C.

Obviously, for use without a program, they are more similar and are, we must all recognize here, both very effective on a daily basis.

HP-15C Code:
Code:
001-42,21,11 LBL A     f A: Start a new game  010-42,21,12 LBL B     f B: Repeat sequence   018-42,21,13 LBL C     f C: Restart inputs    027-42, 5,25 DSE I     Right => loop
002-   45 36 RCL RAN#                         011-    32 7 GSB 7                            019-    32 7 GSB 7                            028-    22 1 GTO 1
003-42,21,15 LBL E     f E: given seed game   012-42,21, 0 LBL 0     Displayed seq loop     020-42,21, 1 LBL 1     Inputed seq loop       029-       1  1        All entry OK
004-    44 0 STO 0                            013-    32 8 GSB 8     get next element       021-   45 25 RCL I                            030-44,40, 1 STO+1     increase seq length
005-       2  2        Default dificulty      014-   42 31 PSE       temporary display ele  022-45,30, 1 RCL-1     Seq index Prompt       031-   22 12 GTO B     and continue game
006-    44 1 STO 1                            015-   42 31 PSE                              023-      31 R/S       Wait for USER entry
007-42,21,14 LBL D     f D: set difficulty    016-42, 5,25 DSE I                            024-   32  8 GSB 8     get next element
008-      13 10^X                             017-    22 0 GTO 0     loop                   025-43,30, 6 x<>y?     (test6) test entry
009-    44 2 STO 2                                                                          026-    22 9 GTO 9     Wrong => Game over
Code:
032-42,21, 7 LBL 7     ss-prg: Reset seq      039-42,21, 8 LBL 8     ss-prg: Next element   045-42,21, 9 LBL 9     End of GAME
033-    45 1 RCL 1                            040-   42 36 RAN#           of the sequence   046-    45 1 RCL 1
034-   44 25 STO I     Reset seq length       041-45,20, 2 RCL*2                            047-45,20, 2 RCL*2     display end score
035-    45 0 RCL 0                            042-42, 7, 0 FIX 0                            048-42, 8, 4 SCI 4
036-   44 36 STO RAN#  Reset PRN generator    043-   43 34 RND       to integer value       049-   43 32 RTN      (End of Program)
037-42, 5,25 DSE I     Adjust index           044-   43 32 RTN
038-   43 32 RTN

Usage:
The HP-15C has the advantage of offering User-Labels that are used here as follow:
f - A: start a new game. The calculator displays one by one the elements of a sequence of numbers (by default with 2 digits). When prompting a negative indice, the user is expected to enter the corresponding number of the exact same sequence, one by one without any mistake.

f - E: start a game of a given seed. This allows you to repeat the same game, for example in the case of a duel with a second player.

f - D: change game difficulty . If you are bored of two-digit numbers sequences, you may try 3, 4 … up to 10 digits per number in each sequence.

f - B: In case the player was interrupted by his mobile phone. He can ask the machine to re-display the last sequence.

f - C: In case the player is distracted while entering his answers. He can restart at the beginning of the current input sequence without the machine re-displaying it.

The labels Lbl7 , Lbl8 and Lbl9 are sub-parts of the code that respectively reset the sequence, generate the next number or display the score at the end of the game.

Another feature of the HP-15C that makes it easy to follow Nihotte(ima)'s algorithm is the use of the native pseudo-random generator and its ability to impose STO RAN# or to retrieve RCl RAN# the current seed used by the RAN# instruction.

Registers:
R0: stores the root of the current sequence
R1: n+1 where n is the number of numbers in the current sequence.
R2: Game difficulty (as power of ten for easy number generation).
RI: index of the number in the current sequence.
RAN#: seed of the next pseudo-random number.


Amicales Salutations.
C.Ret
Find all posts by this user
Quote this message in a reply
09-11-2024, 08:22 PM (This post was last modified: 09-11-2024 08:27 PM by Nihotte(lma).)
Post: #10
RE: (HP12C) Always a number further !
(09-07-2024 09:32 AM)C.Ret Wrote:  ...

In order to illustrate your words, I share a code for my HP-15C based on your algorithm...
Of course, there are a lot of other ways of doing it. But the idea is to give an overview of the differences in the programming style between models HP-12C and HP-15C.

...
C.Ret



Merci beaucoup C.Ret!

This is a nice, very user-oriented achievement.

And the very careful layout of the post impresses me, like the best ones that we enjoy browsing on the threads of Thomas Klemm or Valentin Albillo, for example!

The facilities offered by a calculator like the HP15C or the HP11C are well highlighted. On the HP12C the programmer will look more for a very linear progression.

Further, the use of another calculator, such as the HP41C, would also make it possible to benefit from the compartmentalization of each program, one in relation to another, and to be able to reuse labels A, B, C, D and E without limitation, as local labels, while they are global on the HP15C. In a way, the coexistence of several programs in memory, all equipped with the features that you have deployed, is made easier on the HP41C while putting more responsibility on the HP15C programmer.

Keep yourself healthy!

Amicalement,

Laurent
Find all posts by this user
Quote this message in a reply
09-12-2024, 12:10 PM
Post: #11
RE: (HP12C) Always a number further !
(09-07-2024 09:32 AM)C.Ret Wrote:  In order to illustrate your words, I share a code for my HP-15C based on your algorithm...

This listing can be used with this HP-15C simulator:
Code:
   001 { 42 21 11 } f LBL A    ; f A: Start a new game
   002 {    45 36 } RCL 36     ;
   003 { 42 21 15 } f LBL E    ; f E: given seed game
   004 {    44  0 } STO 0      ;
   005 {        2 } 2          ; Default dificulty
   006 {    44  1 } STO 1      ;
   007 { 42 21 14 } f LBL D    ; f D: set difficulty
   008 {       13 } 10^x       ;
   009 {    44  2 } STO 2      ;
   010 { 42 21 12 } f LBL B    ; f B: Repeat sequence
   011 {    32  7 } GSB 7      ;
   012 { 42 21  0 } f LBL 0    ; Displayed seq loop
   013 {    32  8 } GSB 8      ; get next element
   014 {    42 31 } f PSE      ; temporary display ele
   015 {    42 31 } f PSE      ;
   016 { 42  5 25 } f DSE I    ;
   017 {    22  0 } GTO 0      ; loop
   018 { 42 21 13 } f LBL C    ; f C: Restart inputs
   019 {    32  7 } GSB 7      ;
   020 { 42 21  1 } f LBL 1    ; Inputed seq loop
   021 {    45 25 } RCL I      ;
   022 { 45 30  1 } RCL - 1    ; Seq index Prompt
   023 {       31 } R/S        ; Wait for USER entry
   024 {    32  8 } GSB 8      ; get next element
   025 { 43 30  6 } g TEST 6   ; (test6) test entry
   026 {    22  9 } GTO 9      ; Wrong => Game over
   027 { 42  5 25 } f DSE I    ; Right => loop
   028 {    22  1 } GTO 1      ;
   029 {        1 } 1          ; All entry OK
   030 { 44 40  1 } STO + 1    ; increase seq length
   031 {    22 12 } GTO B      ; and continue game
   032 { 42 21  7 } f LBL 7    ; ss-prg: Reset seq
   033 {    45  1 } RCL 1      ;
   034 {    44 25 } STO I      ; Reset seq length
   035 {    45  0 } RCL 0      ;
   036 {    44 36 } STO 36     ; Reset PRN generator
   037 { 42  5 25 } f DSE I    ; Adjust index
   038 {    43 32 } g RTN      ;
   039 { 42 21  8 } f LBL 8    ; ss-prg: Next element
   040 {    42 36 } f RAN #    ;      of the sequence
   041 { 45 20  2 } RCL * 2    ;
   042 { 42  7  0 } f FIX 0    ;
   043 {    43 34 } g RND      ; to integer value
   044 {    43 32 } g RTN      ;
   045 { 42 21  9 } f LBL 9    ; End of GAME
   046 {    45  1 } RCL 1      ;
   047 { 45 20  2 } RCL * 2    ; display end score
   048 { 42  8  4 } f SCI 4    ;
   049 {    43 32 } g RTN      ; End of Program
Find all posts by this user
Quote this message in a reply
Post Reply 




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