Jump to content
IGNORED

Mastermind for INTV


vprette

Recommended Posts

something strange:

 

I try to read 4 inputs (limited to 1-6 range) from the controller, but as soon as I hit the keypad first time, all the 4 values on the matrix seqpo(ii) are filled by this unique value and the program call "exit"

 

ii=1

 

leggi_seq_orig:

gosub hit2
if tasto <7 then seqpo(ii)=tasto:ii=ii+1
wait
rem if ii>4 goto exit
goto leggi_seq_orig

 

 

hit2: procedure
tasto=15
wait
IF CONT2.KEY=1 or CONT1.KEY=1 THEN tasto=1
IF CONT2.KEY=2 or CONT1.KEY=2 THEN tasto=2
IF CONT2.KEY=3 or CONT1.KEY=3 THEN tasto=3
IF CONT2.KEY=4 or CONT1.KEY=4 THEN tasto=4
IF CONT2.KEY=5 or CONT1.KEY=5 THEN tasto=5
IF CONT2.KEY=6 or CONT1.KEY=6 THEN tasto=6
IF CONT2.KEY=7 or CONT1.KEY=7 THEN tasto=7
IF CONT2.KEY=8 or CONT1.KEY=8 THEN tasto=8
IF CONT2.KEY=9 or CONT1.KEY=9 THEN tasto=9
return
end

Edited by vprette
Link to comment
Share on other sites

something strange:

 

I try to read 4 inputs (limited to 1-6 range) from the controller, but as soon as I hit the keypad first time, all the 4 values on the matrix seqpo(ii) are filled by this unique value and the program call "exit"

 

ii=1

 

leggi_seq_orig:

gosub hit2

if tasto <7 then seqpo(ii)=tasto:ii=ii+1

wait

rem if ii>4 goto exit

goto leggi_seq_orig

 

 

hit2: procedure

tasto=15

wait

IF CONT2.KEY=1 or CONT1.KEY=1 THEN tasto=1

IF CONT2.KEY=2 or CONT1.KEY=2 THEN tasto=2

IF CONT2.KEY=3 or CONT1.KEY=3 THEN tasto=3

IF CONT2.KEY=4 or CONT1.KEY=4 THEN tasto=4

IF CONT2.KEY=5 or CONT1.KEY=5 THEN tasto=5

IF CONT2.KEY=6 or CONT1.KEY=6 THEN tasto=6

IF CONT2.KEY=7 or CONT1.KEY=7 THEN tasto=7

IF CONT2.KEY=8 or CONT1.KEY=8 THEN tasto=8

IF CONT2.KEY=9 or CONT1.KEY=9 THEN tasto=9

return

end

 

Like 5-11under said, you need to wait for a key release.

 

Add a routine like this:

wait_for_release: PROCEDURE
  release_count ~ 0
wr_loop:
  WAIT
   IF CONT2.KEY=12 AND CONT1.KEY=12 THEN release_count = release_count+1 ELSE release_count= 0
   if release_count < 20 then goto wr_loop
 END

And then call it from here:

 

leggi_seq_orig:

gosub hit2

if tasto <7 then seqpo(ii)=tasto:ii=ii+1

gosub wait_for_release

wait

rem if ii>4 goto exit

 

 

I haven't tested this...

 

 

Catsfolly

Edited by catsfolly
  • Like 2
Link to comment
Share on other sites

Sometimes I do the wait-for-keypress-release routine just before going into the wait-for-keypress routine.

That's a good pattern to follow if you need to ensure new input from the player. For instance, in menu selection, where you want to guarantee a new selection and discard any current buffered value from a previous input.

Link to comment
Share on other sites

Like 5-11under said, you need to wait for a key release.

 

Add a routine like this:

wait_for_release: PROCEDURE
  release_count ~ 0
wr_loop:
  WAIT
   IF CONT2.KEY=12 AND CONT1.KEY=12 THEN release_count = release_count+1 ELSE release_count= 0
   if release_count < 20 then goto wr_loop
 END

And then call it from here:

 

leggi_seq_orig:

gosub hit2

if tasto <7 then seqpo(ii)=tasto:ii=ii+1

gosub wait_for_release

wait

rem if ii>4 goto exit

 

 

I haven't tested this...

 

 

Catsfolly

 

many many thanks

Link to comment
Share on other sites

Here's my feedback:

  • Sometimes key presses are not registered and I have to press the key multiple times for it to be detected. This is especially so when I want to use the same colour peg multiple times.
  • The input is so flakey, it gets in the way of playing.
  • I don't understand the key peg sequences, I think they are wrong. Take a look at the attached screenshot: the same sequence repeated multiple times yields different key peg combinations.
  • Shouldn't there be 4 key pegs, one for each position? I guess it shows the number of either black or white pegs.

post-27318-0-22807900-1415728756_thumb.gif

Link to comment
Share on other sites

Here's my feedback:

  • Sometimes key presses are not registered and I have to press the key multiple times for it to be detected. This is especially so when I want to use the same colour peg multiple times.
  • The input is so flakey, it gets in the way of playing.
  • I don't understand the key peg sequences, I think they are wrong. Take a look at the attached screenshot: the same sequence repeated multiple times yields different key peg combinations.
  • Shouldn't there be 4 key pegs, one for each position? I guess it shows the number of either black or white pegs.

attachicon.gifshot0000.gif

 

for some reason that I need to find from the 3rd sequence the values are miss calculated, so only seq 1 and 2 work for now :-)

for the buttons I notice the same: it started when I introduced the gosub wait_for_release from above, so something must be optimized

you need to find the sequence of 6 possible colors

key pegs on the right show: right color in right position (black) and right color in wrong position (white)

Edited by vprette
Link to comment
Share on other sites

I also fixed the button response

 

and this is the final version I distribute to all

 

instructions:

find a sequence of 4 colors

each choice is between 6 colors(keypad 1-6)

at the right side you see a black * = number of correct colors in correct position

and a white * = number of correct colors in wrong position in the sequence

 

game also store the record (less sequences used before finding the solution

 

hit disc at the end to restart

 

I hope you like the game

 

 

master_v1.rom

Link to comment
Share on other sites

I managed to beat it once. But I think there's still a problem with the key pegs code: sometimes the responses to consecutive inputs is not congruent. The input problems were corrected, though.

 

I'll keep playing to see if I can find a specific pattern that doesn't work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...