1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development Turing help (for school)

Discussion in 'Software' started by speX, 12 Jun 2005.

  1. speX

    speX What's a Dremel?

    Joined:
    5 Jun 2005
    Posts:
    11
    Likes Received:
    0
    I have a question for my math game, suppositly after every level (10 questions) the # of digits for the quetsions are suppose to increase... like 8+6 would be level one and level 2 would be 88+66 and level 3 would be 888+666 etc..... how do i make the digits increase ( max number is 9 in level one, level 2 max number 99, level 3 max number 999) (these numbers are created at random.....)plz help
     
  2. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    okay, i think i speak for everyone reading this when i say you've not told us what your doing.

    Your making a game (what language)

    Now every level the number of digits for the questions increase? so like question 15, would be level 2, question 5? 83 would be level 2 question 73?

    whats going on with the number + number thing?

    Start the begining. Turing is a very famous person, and there a quite a few challenges with his name attached, most famously making a computer appear to be human, so its not really very descriptive.
     
  3. speX

    speX What's a Dremel?

    Joined:
    5 Jun 2005
    Posts:
    11
    Likes Received:
    0
    turing is the language......................................

    there are 3 numbers (generated at random)
    1 number is the first number of the question
    the second number from 0-2 will determin if its addition, subtaction or multiply
    the third number will be the second number of the question

    so after running after the 3 lines of code and a few if statments there will be an equation

    1+1, 2-1 , or 3X3

    now thats level one

    after 10 questions it will reach level 2
    my question is how to make it from 1+1 or 2-1 etc to 11+11 or 21-20 after the completion of level 1 and when level 2 is done there should be 3 digits like 111+111 or 222-111 etc..... and so on as the levels increase like when the user reaches level 6, there should be 6 digits in the equation.... what i want to know is HOW to increase the digits
    i
     
    Last edited: 13 Jun 2005
  4. alextwo

    alextwo <a href="http://forums.bit-tech.net/showpost.php?p

    Joined:
    29 May 2003
    Posts:
    774
    Likes Received:
    22
    OK I've never heard of the Turing language but what is the code you are using to generate the random number because you should be able to do it from that.
     
  5. speX

    speX What's a Dremel?

    Joined:
    5 Jun 2005
    Posts:
    11
    Likes Received:
    0
    randint (intRan1, 0, 9) %random number 1
    randint (intRan2, 0, 9) %random number 2
    randint (intRanSym, 0, 2) %determins the equation
     
  6. Hepath

    Hepath Minimodder

    Joined:
    20 Oct 2003
    Posts:
    730
    Likes Received:
    0
    Ok,
    I too have never heard of "Turing" as a programming language, but I'm guessing the nub of the point here not so much the problem, but creating the series of numbers given a starting digit.

    i.e
    if your start number is 7, then it increases as a series: 77, then 777 etc.


    So:

    1. you need a string to hold the "current string number"
    2. you need to remember the starting digit
    3. you need a method to convert "current string number" to a proper numeric.

    Doing a quick google for "Turing Programming Language" it says its an programming language designed to show OO techniques, so trying not to be to procedural, heres a pseudo-turing-class (cos I have literally spent no more than 5 minutes looking at this link

    Code:
    class MyNumber
    {
         export Initialise, GetNumeric   
         
         var start_number : int
         var internal_number : int
         var stringnumber : string
    
         procedure Initialise
              number := randint (start_number, 0, 9)
         end SetNumeric
    
         procedure SetToLevel(level : int)
             var string_value : string
             for i : 1 .. level
                  string_value := string_value + stringnumber; % is this string concatenation?
             end for
    
             internal_number := ConvertToInteger(string_value) % no idea what the function is!
    
         end SetToLevel
    
         procedure GetNumber
              result internal_number
         end GetNumber
    }
    So your program would be....

    Code:
    var number1 : MyNumber
    var number2 : MyNumber
    var operand  : MyOperand
    
    var x, y : int
    
    new number1
    new number2
    new operand
    
    number1 -> Initialise
    number2 -> Initialise
    operand -> Initialise
    
    for level := 1..10
         number1 ->SetLevel(level)
         number2 ->SetLevel(level)
         x := number1->GetNumber
         y := number1->GetNumber
    
         operand ->Calculate(x, y);
    
    end for
    
    Having written this much I'll let you sort out the other class "MyOperand" that is required - its not too difficult to figure out what's required... and I am not going to do all the work for you :) Added to that I I dont no the syntax or commands available.....

    Good luck
     
  7. alextwo

    alextwo <a href="http://forums.bit-tech.net/showpost.php?p

    Joined:
    29 May 2003
    Posts:
    774
    Likes Received:
    22
    Surely you can just do

    randint (intRan1, 10, 99) and the same for intRan2
    if you want to just create a two digit random number as it will only give you a number between 10 and 99. Or have I misunderstood. Does the two digit number need to be two of the same number e.g. 22 if the one digit number was 2?
     
  8. speX

    speX What's a Dremel?

    Joined:
    5 Jun 2005
    Posts:
    11
    Likes Received:
    0
    it was suppose to increase digits after 10 questions of running.... READ the whole thread before posting :p haha
    i got it working now thx for your help everyone :D
     
  9. Hepath

    Hepath Minimodder

    Joined:
    20 Oct 2003
    Posts:
    730
    Likes Received:
    0
    Spex,

    You say you have finshed it - well done :thumb: . Could you post your source? I for one am interested as to how you did it.

    Given that this an uncommon programming language I'd love to know.
     
  10. speX

    speX What's a Dremel?

    Joined:
    5 Jun 2005
    Posts:
    11
    Likes Received:
    0
    hey hepath ill pm you for my code i dont want to take the risk of someone in my class readinng my code and copy then i would be in **** >_> lol turing is a very very basic language haha

    EDIT: umm turns out my code is too long to pm >_> haah how about e-mail? ill e-mail it to you (pm me with your e-mail if you really wana see it still haha but basically all i did was
    intIncrease := ((intIncrease * 10) + 9)
     
    Last edited: 14 Jun 2005

Share This Page