Post Reply 
(FX-602P) Master Logic - Mastermind - Code-breaking Game with letters display
09-23-2024, 10:18 PM (This post was last modified: 09-23-2024 10:57 PM by Nihotte(lma).)
Post: #1
(FX-602P) Master Logic - Mastermind - Code-breaking Game with letters display


Hello everyone !

Mastermind is a wellknown game for two players : a codemaker chooses a combination of four or five pegs and the other player will try to break this code.

This publication is based on a program I have written for the Casio FX-602P in 2004 : I actualised it on this 09/2024
The FX-602P was a very interesting calculator at its time because it could display messages like a HP41C but it could not manage characters
This calculator was also capable of supporting a keystroke while pausing (PAUSE instruction) during program execution

I designed this program to accept the entry of attempts as if it were directly the entry of the color.
For this, you must enter the color of each pawn of the guess by its number in the ordered list of colors displayed to you by the FX-602P.
In fact, you should play with a real board at the side of the calculator.
Just key in the 6 (..9) colors of the pegs as you have prepared P0 and P6. For me, Blue is 1 and Orange is 4.

Just enter INV P9 to start the program
You receive BVJORM→? at display when you can choose your guess and EXE
The 602P answers the number of pegs you have found (B) and the number of pegs with only the good color (W) because they are not well-placed

The number of attempts is limited to 6 (in P3)
The number of pegs in a combination is declared on P1 (with 4)
The ordered list of available colors is known by P0 (BVJORM) and the number of colors (6) is known by P2. The display is assumed by P7-->P6
P0 and P2 are linked and must be entered jointly: a list of 6 to 9 colors in P0 and an equivalent number of colors in P2 (6 to 9).
Likewise, P0 and P6 are linked: the order of the colors used in P6 coincides with the list of colors which appear in P0.
However, P6 can maintain a maximum structure of 9 colors without disturbing the operation of the program.
The particularity of P6 is to make the link between the color code (1 for B and 4 for O, for example) through a GOTO instruction according to the content of M00.
If the color code does not exist in P6 (1..9), it will be replaced by a hyphen (-) instead of the initial letter of the color.

This program manages codes with a length from 4 to 6. If the 602P turns off automatically, you can always resume with P4.

See the code below

Code:

**P9
MAC GSBP1 Min00
LBL0
RAN# RAN# x GSBP2  + 1 = INT
IND Min00
DSZ
GOTO0
GSBP4
18 bytes

**P4
LBL0
AC Min13 Min14
GSBP0 ";→?"
HLT
x=0 GOTO0
÷ GSBP1 Min00 Min1F  M+1F  10^x  = Min16
LBL1
MR16 x 10 = Min16 INT
x=0 GOTO0
M-16
IND Min1F MinF
IND MR00 INT
IND Min00
x=F GSBP8
1 M-1F
DSZ
GOTO1
GSBP1 Min1F M+1F
LBL1
IND MR1F MinF FRAC M-F
x=0 x=F GOTO4
GSBP1 Min00
LBL2
MRF - IND MR00 =
x=0 x=F GOTO3
GSBP8
1 M+14
GOTO4
LBL3
DSZ
GOTO2
LBL4
GSBP1 MinF 
1 M+F M-1F MR1F
x≥F GOTO1
1 M+15
GSBP1 MinF Min1F M+1F
MR14 M-13
"AR15."
GSBP7
"; AR13BAR14W"
HLT
MR13 MinF
GSBP1
x=F GOTO5
MR15 MinF 1 M+F
GSBP3
X≥F GOTO0
LBL5
"CODE="
GSBP1 Min1F MinF
GSBP7
";"
135 bytes

**P0
"BVJORM"
9 bytes

**P1
4
2 bytes

**P2
6
2 bytes

**P3
6
2 bytes

**P7
1 M-F
LBL0
IND MR1F INT
GSBP6
1 M-1F M-F MRF
x≥0 GOTO0
MR15
15 bytes

**P8
.1 IND M+00 IND M+1F
1 M+13
9 bytes

**P6
Min00 IND GOTO0
";-"
GOTO0
LBL1 ";B" GOTO0
LBL2 ";V" GOTO0
LBL3 ";J" GOTO0
LBL4 ";O" GOTO0
LBL5 ";R" GOTO0
LBL6 ";M" LBL0
45 bytes

237 bytes
M00-19,F-1F 512 bytes


Here is an example of use for this program:
(Please note that your running could generate other values in M01 to M04 : you just have to replace their contents as indicated to follow the tests)
Code:


INV P9        BVJORM→?    Look at M04=4 M03=1 M02=3 M01=4 : 4134 is the code to break                    
1234 EXE        1.BVJO 2B1W    1234 is BVJO and you find 2 pegs well-placed (with a good color at the good position) and 1 other peg with just a correct color                    
EXE        BVJORM→?                        
4444 EXE        2.OOOO 2B0W    4444 is OOOO and you get 2 pegs well-placed : the right color at the right place for 2 pegs                    
EXE        BVJORM→?                        
2441 EXE        3.VOOB 0B3W    2441 is VOOB and the result is just 3 good colors                    
EXE        BVJORM→?                        
1434 EXE        4.BOJO 2B2W    1434 is BOJO and you success 2 pegs well-placed and 2 colors at the bad place                    
EXE        BVJORM→?                        
4134 EXE        5.OBJO 4B0W    4134 is OBJO : 4 pegs of the awaited colors at the correct places                    
EXE        CODE=OBJO    You win                    
=        5.    In 5 attempts                    
                                
                                
INV P9        BVJORM→?    Look at M04=4 M03=4 M02=6 M01=4 : 4134 is the code to break                    
3456 EXE        1.JORM 1B1W    3456 is JORM and the result is 1 peg well-placed and 1 color correct but at the bad place                    
EXE        BVJORM→?                        
6646 EXE        2.MMOM 0B2W    6646 is MMOM and you just get 2 good colors at the bad place                    
EXE        BVJORM→?                        
…                                
4466 EXE        6.OOMM 3B0W    4466 is OOMM and you find 3 good colors at the correct place                    
EXE        CODE=OOMO    The code to find was OOMO                    
=        6.    You have already made 6 attempts

Between preparing this thread, I came across another very interesting thread, and much older as mine, from SlideRule and Gilles
The thread also presents a Mastermind program intended for the TI-58 and FX-602P.
You will be happy to find it here !

Keep yourself healthy!



Attached File(s)
.pdf  FX-602P - Super MasterMind - lmaN - MoHPC.pdf (Size: 94.61 KB / Downloads: 14)
Find all posts by this user
Quote this message in a reply
09-25-2024, 08:37 PM
Post: #2
RE: (FX-602P) Master Logic - Mastermind - Code-breaking Game with letters display
(09-23-2024 10:18 PM)Nihotte(lma) Wrote:  
Hello everyone !

Mastermind is a wellknown game for two players : a codemaker chooses a combination of four or five pegs and the other player will try to break this code.

Keep yourself healthy!

Interesting, I just searched "Mastermind" on this site yesterday!

I've only played single user Mastermind on a Mattel Electronics "Brain Baffler"
https://www.patheos.com/blogs/tinseltalk...ttel-1979/
But I also used paper and pencil to keep track of each entry update.

10B, 10BII, 10C, 11C, 12C, 14B, 15C, 16C, 17B, 18C, 19BII, 20b, 22, 25, 29C, 35, 38G, 39G, 39gs, 41CV, 48G, 97
Find all posts by this user
Quote this message in a reply
Post Reply 




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