
-----------------------------------
iNsteReo
Thu Apr 30, 2009 12:04 pm

Creating guessing games
-----------------------------------
What is it you are trying to achieve?
I am trying to create a program that would randomly select the order of 4 colors. After this, the user sees 4 boxes( of the same 4 colors, but not in the same order). The user then clicks on the the boxes in order which he thinks the program set the colors in. Then there are 4 LEDS on the outside of the computer, connected to the computer through parallel circuit. The LEDS light up according to how many correct colors the user guessed ( if he got the first and the last color right, the 1st and last LED light up) 
What is the problem you are having?
My problem is making the program random the colors and then getting the user input and matching the user input to the randomed colors. 

Describe what you have tried to solve this problem
I tried to put the 4 colors in an array and randomize it. But i honestly do not even know how to start solving this. 


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
i started out with a little different program, because i know how to this and not what is needed. 



% Dmytro TK
% April, 2009
% The mastermind game
setscreen ("graphics")
var finished : boolean := false
var rangeX, rangeY, button : int


% Program Title
    procedure title
cls
locate (1, 28)
put "The mastermind game"
end title

%Program introduction
procedure introduction
    title
    locate (3, 1)
    put "Click on the boxes to guess in which order the colors were set."
end introduction



    % Displaying Boxes
    procedure userInput
        %draw a blue box on the screen
        drawfillbox (20, 150, 120, 300, blue)
        drawfillbox (150, 150, 250, 300, green)
        drawfillbox (280, 150, 380, 300, black)
        drawfillbox (410, 150, 510, 300, red)
        drawbox (240, 50, 360, 90, black)
        locate (21, 32)
        put "EXIT PROGRAM" ..
        mousewhere (rangeX, rangeY, button)
        for i : 1 .. 4
            if button = 1 then
                if rangeX >= 20 and rangeX = 150 and rangeY = 150 and rangeX = 150 and rangeY = 280 and rangeX = 150 and rangeY = 410 and rangeX = 150 and rangeY = 240 and rangeX = 50 and rangeY = 240 and rangeX = 50 and rangeY > temp) & 1) = 0 then
            order(i) := temp
            used := used | (1 