The Museum of HP Calculators

HP Forum Archive 21

 Good news :-)Message #1 Posted by fhub on 22 Sept 2012, 5:56 a.m. Finally the HP-39gII emulator has officially arrived: Rev.18360 from 4th Sept. Franz

 Re: Good news :-)Message #2 Posted by Nigel J Dowrick on 22 Sept 2012, 7:08 a.m.,in response to message #1 by fhub Thanks, Franz (and HP!). I love the "large" (landscape) skin! I want a real 39gii calculator looking like that one! HP would sell millions of them!!! Is there any updated firmware yet for my real (portrait) 39gii? Nigel (UK)

 Re: Good news :-)Message #3 Posted by Gilles Carpentier on 22 Sept 2012, 7:25 a.m.,in response to message #1 by fhub I forget how to display the rev number on mine ! It was not ON & F4 ? Does this version correct the CASE bug ? I agree that the landscape skin is great :) For those interested, here is my first complex program on this device. "Le compte est bon 'in french... Countdown ... http://en.wikipedia.org/wiki/Countdown_%28game_show%29 ```//================================ // Le compte est bon - HP39gII //-------------------------------- // Variables globales LOp:={" plus "," moins "," fois ", " divisé par "}; Sol; Cible; Ecart;MeilleurCoup,Tirage; // Génére une liste contenant la meilleure solution AffSol (n1,Op,n2,n3) BEGIN Sol:=CONCAT(Sol, ""+MAX(n1,n2)+LOp(Op)+MIN(n1,n2)+"->"+n3); END; // Le coeur du programme LCB(Tab,Nb) BEGIN LOCAL i,j,Op,T1,r:=0; FOR i FROM 1 TO Nb-1 DO FOR j FROM i+1 TO Nb DO FOR Op FROM 1 TO 4 DO Tab=>T1; IF Op==1 THEN // To avoid CASE problem T1(i)+T1(j)=>T1(i); ELSE IF Op==2 THEN ABS(T1(i)-T1(j))=>T1(i); ELSE IF Op==3 THEN T1(i)*T1(j)=>T1(i); ELSE IF (T1(j)<>0) AND (T1(i) MOD T1(j)==0) THEN T1(i)/T1(j)=>T1(i); ELSE IF (T1(i)<>0) AND (T1(j) MOD T1(i)==0) THEN T1(j)/T1(i)=>T1(i); ELSE BREAK; END; END; END; END; END; IF T1(i)==Cible THEN AffSol(Tab(i),Op,Tab(j),T1(i)); r:=1; BREAK(3); END; // RETURN(1) don't work IF ABS(T1(i)-Cible)T1(j); IF LCB(T1,Nb-1) THEN AffSol(Tab(i),Op,Tab(j),T1(i)); r:=1; BREAK(3); END; END; END; END; RETURN r; END; // Le programme principal EXPORT Compte(t,c) BEGIN LOCAL n; Cible:=c; Ecart:=999; MeilleurCoup:=0; Tirage:=t; Sol:={}; PRINT ("***** LE COMPTE EST BON *****"); PRINT (Tirage); PRINT ("Nombre à trouver : " + Cible); PRINT (""); IF NOT(LCB(Tirage,6)) THEN PRINT("Solution la plus proche :" + MeilleurCoup); Cible:=MeilleurCoup; Ecart:=999; LCB(Tirage,6) END; REVERSE(Sol)=>Sol; FOR n FROM 1 TO SIZE(Sol) DO PRINT(" " + Sol(n)); END; RETURN Sol; END; ``` For exemple : Compte({6,6,25,4,100,9}, 923} Edited: 22 Sept 2012, 7:26 a.m.

 Re: Good news :-)Message #4 Posted by Namir on 22 Sept 2012, 8:03 a.m.,in response to message #3 by Gilles Carpentier Gilles .. you are super cool ... I have been working on the same French game .. trying to write an implementation for Excel VBA. Thank you sooooooooooooooooooo much for your listing! Namir

 Re: Good news :-)Message #5 Posted by Gilles Carpentier on 22 Sept 2012, 9:10 a.m.,in response to message #4 by Namir Note that the code would be more lisible with CASE : ``` CASE IF Op==1 THEN T1(i)+T1(j)=>T1(i); END; IF Op==2 THEN ABS(T1(i)-T1(j))=>T1(i); END; IF Op==3 THEN T1(i)*T1(j)=>T1(i); END; IF Op==4 THEN CASE IF (T1(j)<>0) AND (T1(i) MOD T1(j)==0) THEN T1(i)/T1(j)=>T1(i); END; IF (T1(i)<>0) AND (T1(j) MOD T1(i)==0) THEN T1(j)/T1(i)=>T1(i); END; DEFAULT BREAK; END; END; ... ``` But there is a bug with the CASE in my HP39 version. HP knows and is working to solve this in futur update Note also that in the contrary of what is wrote in user guide on the CD, there is no difference between T1(j)/T1(i)=>T1(i) // dont' know why, but i hate this syntax lol... and T1(i):=T1(j)/T1(i) as you can aloso see, the user guide is not accurate about use of LOCAL variables. You can assing value in the same line than the LOCAL definiton The BREAK (level) is interesting (but not documented as far i know; Cyrille explain this here) When I wrote this first verion there was also some problem with the RETURN function in some cases. I think it's solved in the new ROM but not sure. The HP39gII langage is very interesting, simple and powerfull. An interesting improvement could be to allow like in PASCAL to call a function (or a procedure in Pascal) with paramaters 'per variable' and not only 'per value' (sorry for my english). This would allow for exemple to swap 2 variables like this : EXPORT SWAP( VAR : a , VAR : b) BEGIN LOCAL c c:=a; a:=b; b:=c; END; and then use SWAP(x,y) to swap the content of x <-> y . It's very interesting in many cases

 Re: Good news :-)Message #6 Posted by Alexander Oestert on 22 Sept 2012, 10:17 a.m.,in response to message #3 by Gilles Carpentier Ahhh! I love the show "Des chiffres et des lettres" ever since I spend two weeks in a pupil's exchange in France back in 1980. I wonder why this show is running for so long but never was adapted in Germany or elsewhere as far as I know?!? Edited: 22 Sept 2012, 10:18 a.m.

 Re: Good news :-)Message #7 Posted by Namir on 25 Sept 2012, 10:52 p.m.,in response to message #3 by Gilles Carpentier Gilles, Does the first two nested loops in LCB() cover all the possible arrangements for the six numbers given? I suspect they don't. My Excel VBA version uses SIX loops to do that ... and also uses IF statements to make sure that the indices are not duplicated. I checked with a DEBUG.PRINT statement to verify that I am trying ALL the combinations of the six numbers. Namir

 Re: Good news :-)Message #8 Posted by Namir on 26 Sept 2012, 2:01 a.m.,in response to message #7 by Namir Gilles, I was able to adapt your HP39gII code to Excel VBA. I see now that you perform recursive calls to LCB(). Your solution works very well and does it quickly! Namir

 Re: Good news :-)Message #9 Posted by Gilles Carpentier on 26 Sept 2012, 2:10 p.m.,in response to message #8 by Namir Happy this have help you Namir! I will try to do an APPS for this with the 39gII when i have time and the CASE problem is solved.

 Re: Good news :-)Message #10 Posted by C.Ret on 22 Sept 2012, 7:55 a.m.,in response to message #1 by fhub Thank for the news. Who is this man who looks at you during download? I find it disturbing!

 Re: Good news :-)Message #11 Posted by fhub on 22 Sept 2012, 9:05 a.m.,in response to message #10 by C.Ret Quote: Who is this man who looks at you during download? It's not me - I'm much nicer! :-)

 Re: Good news :-)Message #12 Posted by Gilles Carpentier on 22 Sept 2012, 9:12 a.m.,in response to message #11 by fhub Tim perhaps ;) "You had to wait a long time, but it' here ! Enjoy " Edited: 22 Sept 2012, 9:14 a.m.

 Re: Good news :-)Message #13 Posted by Frank Boehm (Germany) on 24 Sept 2012, 8:10 a.m.,in response to message #10 by C.Ret I assume this is the man who cannot afford a calculator (TM) - therefor the chalkboard in the background

Go back to the main exhibit hall