problem at code making (mastermind)

Discussion specific to projects ideas and support.
Post Reply
oriori57
Posts: 3
Joined: 12 Feb 2012, 13:57

problem at code making (mastermind)

Post 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)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: problem at code making (mastermind)

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
mcsummation
Posts: 220
Joined: 23 Jan 2012, 17:07
Location: Round Rock, TX

Re: problem at code making (mastermind)

Post by mcsummation »

What language are you using to program the robot? (This determines what you use to stop the loop.)
oriori57
Posts: 3
Joined: 12 Feb 2012, 13:57

Re: problem at code making (mastermind)

Post 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.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: problem at code making (mastermind)

Post 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?
Last edited by h-g-t on 13 Feb 2012, 15:33, edited 1 time in total.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: problem at code making (mastermind)

Post by hassenplug »

Are you trying to write this program using the graphic software that comes with the LEGO MINDSTORMS?
---> Link to lots of MINDSTORMS stuff under my picture --->
oriori57
Posts: 3
Joined: 12 Feb 2012, 13:57

Re: problem at code making (mastermind)

Post 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!
mcsummation
Posts: 220
Joined: 23 Jan 2012, 17:07
Location: Round Rock, TX

Re: problem at code making (mastermind)

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests