Basic guessing program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • halo combat22
    New Member
    • Oct 2007
    • 24

    Basic guessing program

    I am looking on some help on a program where i have the user enter a random number from say 1-20. I do it until number is chosen. Meanwhile it tells the user it it has gotten cooler or warmer from their last guess.

    ty, any help is appreciated.
  • nev
    Contributor
    • Oct 2007
    • 251

    #2
    I don't understand...

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by halo combat22
      I am looking on some help on a program ...
      Our experts are generally happy to help. But you need to give us some idea of what to help with.

      What version of VB are you using? What have you tried? What are you having trouble with?

      Comment

      • halo combat22
        New Member
        • Oct 2007
        • 24

        #4
        Vb6, i have tried doing such as using 2 vars, 1 for first input and 1 for next input so it is easier. But i have not gone far, it wont display right answer.

        Comment

        • Ali Rizwan
          Banned
          Contributor
          • Aug 2007
          • 931

          #5
          Originally posted by halo combat22
          I am looking on some help on a program where i have the user enter a random number from say 1-20. I do it until number is chosen. Meanwhile it tells the user it it has gotten cooler or warmer from their last guess.

          ty, any help is appreciated.
          I think He/She want to make a programe having artificial intelligence which will guess the mood of user either it is Cool or Warmer from their last guess.
          Is it right?
          I think?
          GOODLUCK
          ALI

          Comment

          • halo combat22
            New Member
            • Oct 2007
            • 24

            #6
            Actual number is 16.
            For instance, the user guesses 5 the first time;
            the user guesses 8 the second time; Msgbox - "you got warmer than your last guess"
            the user guesses 7 the third time; Msgbox-"you got colder"
            It basically loops around until number is guessed.

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              Originally posted by halo combat22
              Actual number is 16.
              For instance, the user guesses 5 the first time;
              the user guesses 8 the second time; Msgbox - "you got warmer than your last guess"
              the user guesses 7 the third time; Msgbox-"you got colder"
              It basically loops around until number is guessed.
              From your logic it seems ,only checking if the previous number is greater or lesser that the current number will be sufficent.

              > Hotter
              < Cooler

              = ???

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by debasisdas
                From your logic it seems ,only checking if the previous number is greater or lesser that the current number will be sufficent.

                > Hotter
                < Cooler
                No, the logic is that "hotter" or "warmer" means closer to the right answer. "Cooler" means further away, or "more wrong".

                This is a fairly common technique (in some countries) for indicating whether someone is getting closer to or further away from the correct answer, or place.

                Comment

                • kadghar
                  Recognized Expert Top Contributor
                  • Apr 2007
                  • 1302

                  #9
                  Originally posted by Killer42
                  This is a fairly common technique (in some countries) for indicating whether someone is getting closer to or further away from the correct answer, or place.
                  Yeap, here in mexico it's very common. then i think you can just define 3 integers (k,m,n) lets make k the "correct answer" with

                  k = int(rnd*20)+1

                  and then it should look like:

                  [CODE=vb]m=inputbox ("First guess")
                  do
                  if m = k then exit do
                  n=imputbox("nex t guess")
                  if (m-k)^2 > (n-k)^2 then
                  msgbox("warmer" )
                  elseif (m-k)^2 > (n-k)^2 then
                  msgbox("cooler" )
                  else
                  msgbox("neither cooler nor warmer")
                  end if
                  m=n
                  loop
                  msgbox("congrat s")[/CODE]

                  HTH

                  Comment

                  Working...