
-----------------------------------
T.O
Thu Jun 04, 2009 7:28 pm

Mastermind- i cant get the answer to output after the person has had 8 tries
-----------------------------------
What is it you are trying to achieve?
see topic

What is the problem you are having?
see topic

Describe what you have tried to solve this problem
everything

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




    % this chooses the colour code for guessing
    for j : 1 .. 4

        randint (roll, 1, teams)

        if j = 1 then
            code (1) := roll
        end if

        if j = 2 then
            loop

                if roll not= code (1) then
                    code (2) := roll
                    exit
                end if

                randint (roll, 1, 4)

            end loop
        end if


        if j = 3 then
            loop
                if roll not= code (2) and roll not= code (1) then
                    code (3) := roll
                    exit
                end if

                randint (roll, 1, 4)

            end loop
        end if

        if j = 4 then
            loop
                if roll not= code (3) and roll not= code (2) and roll not= code (1) then
                    code (4) := roll
                    exit
                end if

                randint (roll, 1, 4)

            end loop
        end if


        code (j) := roll

             
         put code (j), "         " ..
  
    end for


Please specify what version of Turing you are using
4.1.1

-----------------------------------
TheGuardian001
Thu Jun 04, 2009 9:52 pm

Re: Mastermind- i cant get the answer to output after the person has had 8 tries
-----------------------------------
It's rather hard for us to figure out what's wrong with your code when you only give us a small chunk that we can't run and it has no comments.
