(17BII) Mastermind
04-30-2020, 08:45 PM (This post was last modified: 04-30-2020 08:51 PM by Nihotte(lma).)
Post: #1
 Nihotte(lma) Member Posts: 73 Joined: Mar 2020
(17BII) Mastermind
This time, it's a function for the HP17BII to search Mastermind code
I think my formula needs to be modify to run on the HP17BII+ because i use some multiply by 0
But it could run on HP27S too

The formula is close to the mechanism in use for the program running on the 12C

You should see the 3 steps :
1) generates the code to break (MIND) when N is 0
2) search for black positions between MIND and N (the user attempt) and prepares the white step
3) search for white positions among the remaining non black positions

There is the code :

Code:
 EVAL = IF( N=0 :        L( MIND : Σ ( I : 1 : NIVO : 1 : ALOG( I – 1 ) x INT( 1 + 9 x             L( RAN# : IF( FP( RAN# ) = 0 : ,5284163 : FP( RAN# x 997 ) ) ) ) ) )  x L( NB : 0) :       L( TV : N ) x 0 + L( MD : MIND ) x 0 + L( NB : NB + 1 ) x 0 + L( TW : 0 ) + L ( MW : 0 ) +       N + ,1 x ( Σ ( I : 1 : NIVO : 1 :                IF( L( TI : INT( 10 x FP( G( TV ) ÷ L( DV : ALOG( I ) ) ) ) ) =                      L( MI : INT( 10 x FP( G( MD ) ÷ G( DV ) ) ) ) : 1 :                      L( TW : G( TW ) + ALOG( G( TI ) - 1 ) ) x 0 +                      L( MW : G( MW ) + ALOG( G( MI ) - 1 ) ) x 0 ) ) ) + ,01 x ( Σ ( I : 1 : 9 : 1 :                  MIN( INT( 10 x FP( G( TW ) ÷ L( DV : ALOG( I ) ) ) ) :                            INT( 10 x FP( G( MW ) ÷ G( DV ) ) ) ) ) )  )

Example of use :

[CALC] → [EVAL] [ N ] [ NIVO ] [ RAN# ] [ MIND ] [ NB ]
DSP [ FIX ] 2 INPUT

,123456789 [RAN#]
5 [NIVO]
0 [N]
[EVAL] → EVAL=0,00

12399 [N] [EVAL] → EVAL=12399,05 : 0 black position but 5 white positions
99321 [N] [EVAL] → EVAL=99321,32 : 3 black positions and 2 white positions
93921 [N] [EVAL] → EVAL=93921,50 : all 5 positions found
RCL [NB] → NB=3,00 after 3 attempts

0 [N]
[EVAL] → EVAL=0,00
xxxxx [N] [EVAL] and so on
 « Next Oldest | Next Newest »

 Messages In This Thread (17BII) Mastermind - Nihotte(lma) - 04-30-2020 08:45 PM RE: (17BII) Mastermind - pinkman - 04-30-2020, 10:08 PM RE: (17BII) Mastermind - Nihotte(lma) - 05-01-2020, 07:34 AM

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