Page 1 of 1

problem at code making (mastermind)

Posted: 12 Feb 2012, 14:16
by oriori57
Hello everybody
Im 16 years old and my friends and I neen help on my school project.
We need to make a robot that propose a human thinking. we decided to make a robot who play "mastermind" in the position of the one who hides a code from the player.

We desinged a robot, that the input are 3 NXT buttons and 3 Touch sensors that represents the 6 colors, and the output is 2 lamps that propose the white and black pins.

now is the problem: we want to program it to read the inputs and put them in the variables, but we haven't find a way to write them corectly yet.
We tried to put 4 loops (of 4 positions for colors) of 5 seconds, that include "wait for sensor" and after him "write to variable". but we had a problem: if we want to stop the loop, 5 seconds must pass AND the loop must end, therefor we want to stop the loop in the middle of it somehow.

We need help by fixing the loops to work in the way we want, or another way to do this.

Thanks Alot!!
(im from israel so dont judge my english)

Re: problem at code making (mastermind)

Posted: 12 Feb 2012, 21:57
by afanofosc
Can you please post what language you are programming in and, if possible, some or all of the code that you have tried? I don't really understand what you mean by the inputs and outputs. You have a 4 digit code where each digit is one of 6 "colors". Correct? How can you then tell the player what he has wrong or right with only two outputs? It's been a while since I played mastermind and I still have a bad head cold so maybe I'm not thinking straight.

John Hansen

Re: problem at code making (mastermind)

Posted: 12 Feb 2012, 21:58
by mcsummation
What language are you using to program the robot? (This determines what you use to stop the loop.)

Re: problem at code making (mastermind)

Posted: 13 Feb 2012, 13:54
by oriori57
thanks for the fast replies!

First of all, i program in english, but english is not my first language so i may not explain some of the things correctly.

Secondly, about the inputs and outputs: my inputs are 3 nxt buttons and 3 touch sensors, and every button is a number between 0~5, and the 4-digit code will be made according to the buttons\sensor i clicked on, for exemple, if left button=0 enter=1 right=2 touch1= 3 touch2=4 touch3=5, and i clicked: left -> enter -> touch1 -> touch3 the code will be: 0135
about the outputs the are 2 lamps that represent the 2 colors of pins, if the white lamp will flick twice, the player will know that he put 2 colors in the right place/

this was my plan, but i have not found a way to program the code input yet.

ill be happy for solution or other way to make this code.

Re: problem at code making (mastermind)

Posted: 13 Feb 2012, 14:02
by h-g-t
By language, he means 'what computer language?'

Are you using NXT-G 1.0, NXT-G 2.0, NXC, RobotC or whatever?

Re: problem at code making (mastermind)

Posted: 13 Feb 2012, 14:09
by hassenplug
Are you trying to write this program using the graphic software that comes with the LEGO MINDSTORMS?

Re: problem at code making (mastermind)

Posted: 14 Feb 2012, 21:00
by oriori57
forget about the language! everything is in english

im using NXT-G 1 with the software LEGO MINDSTORMS and i cant reach to the right solution of my problem.

all i need is help with the code making.
PLZ help!!


*** i'll be if someone will recommend me about a better software to program NXT-G1 programs



Thanks for you all!

Re: problem at code making (mastermind)

Posted: 14 Feb 2012, 21:20
by mcsummation
The answer to the "language" question is "NXT-G1".

Have you tried using a Timer block ORed with whatever your "exit" is to stop the loop?