Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Mastermind- i cant get the answer to output after the person has had 8 tries
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
T.O




PostPosted: Thu Jun 04, 2009 7:28 pm   Post subject: 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)


Turing:


    % 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
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Thu Jun 04, 2009 9:52 pm   Post subject: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: