![]() |
Mastermind for HP-42s - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Mastermind for HP-42s (/thread-249146.html) |
Mastermind for HP-42s - Tom Grydeland - 08-30-2013 Created in fits of boredom in school ~25 years ago, printed on thermal paper, lost and forgotten. Now recreated from memory, probably only similar to the original in functionality. Since the display has limited colour capabilities, the integers 1-7 are used instead. Issues: 1) Your first guess is always '1234'. It would be easy to change, but it is the way I play, so I don't bother 2) I am sure there are superfluous redundancies in there, feel free to suggest improvements. Issues for users of the '42s' iOS emulator in particular: 1) Assumes 4-level stack. (Disable dynamic stack) 2) Uses flags 1-4, switch off flag indicators or have the game spoiled.
00 { 289-Byte Prgm }
Enjoy!
Re: Mastermind for HP-42s - Gilles Carpentier - 08-30-2013 I've no HP42s and can't test but the code seems fine and compact. Here is an old version I wrote long time ago for CASIO FX-602P http://www.ledudu.com/casio602p/mastermind.htm
By the way I'm curious if it exists for such calcultors a program to solve the game in a minimum of moves... I wrote this in the past for the 602P (probably not with the best strategy) but I don't remember at all how I did Edited: 30 Aug 2013, 5:09 a.m.
Re: Mastermind for HP-42s - Tom Grydeland - 08-30-2013
Quote:
The code runs under free42 and its derivatives...
Re: Mastermind for HP-42s - Matt Agajanian - 08-30-2013 Thanks! You should submit this to the Program Library here at MoHPC.
Re: Mastermind for HP-42s - Tom Grydeland - 08-31-2013 I could do that. Would you need much more than the above?
--T
Re: Mastermind for HP-42s - Mike T. - 08-31-2013 I only had an HL33C and despite only having 49 programming steps I remember that I tried to implement a version of Mastermind.
001=0 0 To run the program .5284163 - Random number seed Program halts when (if) you guess all 4 digits correctly! Looking back at my original code I'd definatly do some things differently, but I don't think I could shorten things enough to allow me to check for both black and white pegs... Mike T. Re: Mastermind for HP-42s - Gerson W. Barbosa - 08-31-2013 Quote: That's a great advantage! Having much more steps at my disposal only made me lazy and inefficient :-) (I had a TI-59 in 1982 and an HP-15C in 1983). 125 steps on the HP-15C: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv014.cgi?read=68346 This is slightly shorter (117 steps). Here a nice wp34s implementation by Jeff O. Also, a Turbo Pascal version. Regards,
Gerson.
Re: Mastermind for HP-42s - Tom Grydeland - 09-01-2013 All of these variations stipulate no repeated digits, which certainly makes the scoring (and guessing) much simpler. Part of the reason I need eight flags in the 42s version is to deal with the complexity due to repeated digits -- I must keep track of every digit that has already been awarded a (black or white) pin, both in the guess and in the solution.
Re: Mastermind for HP-42s - Tom Grydeland - 09-01-2013 Quote:
Very good question. I found
--T
Re: Mastermind for HP-42s - Kimberly Thompson - 09-02-2013 Tom
I wrote an HP-25c version (~= 1975)of MM that closely conforms with the original board game using the following convention: [Machine]Registers initialization is important R0 = 1.0Program STARTS @ Line 00 with R/S & loops with the SCORE displayed in the X stack register (FIX 0) as Nn where N = # of digits (colors) in correct position (black flags) & n = # of digits (colors) out of correct position (white flags). My scoring algorithm is slightly unorthodox (unconventional) in that I score the BLACK-flags value twice, thus avoiding the usual complications asscociated with the WHITE-flags scoring algorithm {slightly convoluted, but VERY effective}. *note = original listing used CLX to disable stack lift but the emulator seems to omit this behavior - took me a little while to run to ground this discrepancy. I hope this helps you w your interpretation of a CLASSIC game. BEST!
SlideRule Edited: 9 Sept 2013, 7:34 p.m. after one or more responses were posted
Re: Mastermind for HP-42s - Kimberly Thompson - 09-02-2013 Mike the HP-25 program above should work unaltered for a 33, ie runs on the RPN Calc 33 simulator OK. Enjoy!
SlideRule Edited: 2 Sept 2013, 3:46 p.m.
Re: Mastermind for HP-42s - Tom Grydeland - 09-05-2013 That looks amazingly compact, Kimberly. I'm impressed. I'll try to figure out how it works, to see if I can shorten my own offering with the same tricks. What do you mean by "3-6 digit code"? Does the program work with variable-length codes? Unchanged? Thank you,
--T
Re: Mastermind for HP-42s - Kimberly Thompson - 09-05-2013 Tom
YES, the length of the CODE is variable. I suggest a length of 3 as a minimum (ie 246) so as to avoid a 'trivial' session and a length of 6 as a maximum (ie 123456) to ameliorate complexity. The PRGM scoring routine accommodates a variable length CODE.
SlideRule
|