Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,582 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,925 people online right now. Registration is fast and FREE... Join Now!




Opposite of Random number game

 
Reply to this topicStart new topic

Opposite of Random number game, Let computer guess

yama4ever
28 Sep, 2008 - 01:48 PM
Post #1

New D.I.C Head
*

Joined: 28 Sep, 2008
Posts: 2

Hello, ive just started programming on my school. Im currently programming in blitzmax/blitz3d.
Now my teacher asked me to make the Guess the number game (u all know probably) but then the opposite way.
So that i fill in a number, and the computer guesses it as fast as it can (between 1 and 100).
for example, it should look like this in it finished form:

Choose a number between 1-100
'example' 27

Computer is guessing now
50
to high
25
to low
38
to high
32
to high
29
to high
27

Congratulations computer!
U have chosen the right number '27' in (how many steps it needed to find it)

Now the teacher told me i could not ask help from him or anything.. i needed to find it on my own, since i only had like 3 hours of programming yet.. its impossible for me to do that without help. so thats why i am asking you guys for help smile.gif

Please help me with this, and post the script or something..

Thank you,

Tobian Wuite


User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: Opposite Of Random Number Game
28 Sep, 2008 - 02:06 PM
Post #2

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 3,995



Thanked: 16 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
think about it logically, how would you do this without code. Then try and work that into a somewhat logical order, known a pseudo-code. That leads directly to the solution.

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

yama4ever
RE: Opposite Of Random Number Game
28 Sep, 2008 - 02:20 PM
Post #3

New D.I.C Head
*

Joined: 28 Sep, 2008
Posts: 2

QUOTE(William_Wilson @ 28 Sep, 2008 - 03:06 PM) *

think about it logically, how would you do this without code. Then try and work that into a somewhat logical order, known a pseudo-code. That leads directly to the solution.

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.


Thats the problem m8.. i cant try to make it, i had 1 lesson in programming.. how should i know all the commands and scripts and whatever if i never had it before. I already tryed to explain the teacher that there is no way i could do this without help, but he refused.. he just said 'i dont care how u get it done, i just want u to get it done'

So thats why i asked for the code/script whatever u call it. i know i have to learn.. but thats hard when i dont know were to start.
if someone could give me the code/script, then i should be able to see what is goin on, and how it works..

Thank you..

(sleeping now)

User is offlineProfile CardPM
+Quote Post

Locke37
RE: Opposite Of Random Number Game
28 Sep, 2008 - 05:21 PM
Post #4

I'm not a thief...I prefer the term TREASURE HUNTER!
Group Icon

Joined: 20 Mar, 2008
Posts: 1,031



Thanked: 41 times
Dream Kudos: 325
My Contributions
If you've only had 1 lesson...this might be a little tough. Unless you had about a 5 hour-long lesson...
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Opposite Of Random Number Game
28 Sep, 2008 - 05:29 PM
Post #5

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,997



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
If this is supposed to be done in blitzmax/blitz3d then this is the wrong forum for that, this should be in the Other Languages forum. Moved

Remember one thing, here at Dream.In.Code we're not just going to post the code for you, that's not how we work. We help programmers who need help once they've shown us the work they've done in an attempt to solve their problem. We don't just give the code so they can see how it works, sorry smile.gif

Here is where you can find the user manuals for your language to get you started smile.gif
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Opposite Of Random Number Game
1 Oct, 2008 - 03:19 AM
Post #6

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,539



Thanked: 98 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
Well, think about it logically~
  1. Prompt the user to think of a number.
  2. Declare two variables, min and max
  3. Get the computer to generate a random number, and output it
  4. Get the user to say if it's too high/too low
  5. If it's too high, set max to the value just guessed. If it's too low, set it to min
  6. Generate a random number within the bounds of min/max

I hope that can get you started. smile.gif
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 12:36AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month