Jul 25, 2008

Number Guessing Game - number guessing game

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Game Programming

free web hosting

Number Guessing Game - number guessing game

thek2kid
do you still have the code for that number guessing game?

Reply

biscuitrat
Why don't you try http://www.hotscripts.com? They should have whatever you want.

Reply

cse-icons
what exactly do you mean when u say that number guessing game?
or did u intend to post this as a reply to some topic in another thread....

Cheers.

Reply

gamingnews
Ive got the code for A number guessing game. It's written in BlitzPlus though. (kinda like BASIC i guess)
CODE
;demo02-11.bb - Try to guess the number
Print "Welcome to the Guessing Game!"
AppTitle "Guessing Game!"
;Seed the random generator...don't worry, it willl be explained later
SeedRnd MilliSecs()

;Pick a number between 1 and 100
numbertoguess = Rand(1,100)

;The num of guesses the user has used
numofguesses = 0

;set the beginning of loop label
.loopbegin
;Find out the user's guess
guess = Input$("Guess a number ")

;If player guesses outside of range, tell him to guess again
If guess > 100 Or guess < 1
 Print "Pick a number between 1 and 100, silly!"
;Go back to the beginning
 Goto loopbegin
 
EndIf

;Add a guess to the guess counter
numofguesses = numofguesses + 1  

;If the guess is too low, go back to beginning
If guess < numbertoguess Then
 Print "The number was too low."
 Goto loopbegin
;If guess is too high, go back to the beginning
Else If guess > numbertoguess Then
 Print "The number was too high."
 Goto loopbegin
EndIf


Print "You guessed the number " + numbertoguess + " in " + numofguesses  + " tries!"

;Wait five seconds
Delay 5000

 

 

 


Reply

MystiK1337
this is in java
CODE
import TerminalIO.*;
import java.util.Random;

public class project6_1GuessingGame
{
public static void main (String[] args)
{
 KeyboardReader reader = new KeyboardReader();
 Random random = new Random();
 
 int randomNumber,
 guessedNumber = 0;
 char runAgain = 'y';
 
 randomNumber = random.nextInt(101);        
 System.out.println(randomNumber);
 while (runAgain == 'y' || runAgain == 'Y')
 {
  guessedNumber = reader.readInt("Please pick a number between 1 and 100: ");
  if (guessedNumber < randomNumber)
    System.out.println("Too low!\nGuess again!" +"\n");
   if (guessedNumber > randomNumber)
    System.out.println("Too high\nGuess again!" +"\n");
   if (guessedNumber == randomNumber)
    System.out.println("You got it!" +"\n");
  while (guessedNumber != randomNumber)
  {
   guessedNumber = reader.readInt("Please pick a number between 1 and 100: ");
   if (guessedNumber < randomNumber)
    System.out.println("Too low!\nGuess again!" +"\n");
   if (guessedNumber > randomNumber)
    System.out.println("Too high\nGuess again!" +"\n");
   if (guessedNumber == randomNumber)
    System.out.println("You got it!" +"\n");
  }
  runAgain = reader.readChar("Play again (y/n)? ");
  if (runAgain == 'n' || runAgain == 'N')
  {
   System.exit(0);
  }
 }
}
}

Reply

limasol
Delphi, new, dosbox application, paste this in instead of whats there already, if it dosnt work its not my fault as it works fine here.

program Project1;
CODE


{$APPTYPE CONSOLE}

uses
  SysUtils;

const
   version = '1.0';
   title = 'HiLo game';
   author ='F.Shaw';
   date = '06/10/05';
var

   guess, rdmnumber : integer;

begin
{allow program to pick
different rdmnumber each time}
  randomize;

  {display header information}
  writeln(title,' v.',version,'   ',author,'',date);

  {tell computer to take a random number between 1 and 100}
  writeln('randomizing.......done');
  rdmnumber := random(100)+1;
  writeln (rdmnumber);

   repeat
   writeln('enter guess between 1 and 100...');
   readln (guess);
   if guess < rdmnumber
  then writeln ('too low, guess again');

   if guess > rdmnumber
   then writeln ('too high, guess again');

   until guess = rdmnumber;
   writeln ('correct!, press any key to continue, play again sometime.');
   readln;

end.

QUOTE
As pointed out below, sections of 'Code' should be placed inside bbcode '[ code ] [ / code]' tags. Check out the use of the different bbcode tags by clicking on the link in the Shoutbox.

Reply

Inspiron
What programming language you are look for? Actually number guessing game is pretty simple logic to program. Simply it needs to create a random number as the core engine to start the whole game running. I know .NET language quite well. Maybe I can make one for you if you are looking for one in VB.NET.

limasol, please place your codes in the [code] tags.

Reply

devintmiller
QUOTE(thek2kid @ Mar 6 2005, 06:20 PM) *
do you still have the code for that number guessing game?


I have a C++ code if anybody is still intrested. Reply and I will upload it. I uploaded the compiled file. I worte it in Dev-C++ but I learned it from this ebook called 'Beginning C++ Game Programming' . I learned right out of the book. Tell me if you want the ebook I can email it to. Free eBook sent to you by email [attachment=719:15_Guess...mber.exe.zip]

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. vb basic code for number guessing game - 5.36 hr back. (2)
  2. number guess program in c - 6.41 hr back. (1)
  3. guessing number game - 7.62 hr back. (1)
  4. make number guessing game java - 11.88 hr back. (1)
  5. c number ques game - 14.84 hr back. (1)
  6. number guess vb code - 24.64 hr back. (1)
  7. java repeating guess a number game - 24.81 hr back. (1)
  8. how do number guessing game work - 25.03 hr back. (1)
  9. guess game c - 25.77 hr back. (1)
  10. c the guessing game - 26.24 hr back. (1)
  11. random number guessing game - 29.16 hr back. (1)
  12. vb.net codes for guessing game between 1 and 100 - 29.50 hr back. (1)
  13. vb.net guessing game between 1 and 100 - 29.55 hr back. (1)
  14. number guess game in c - 26.36 hr back. (2)
Similar Topics

Keywords : number, guessing, game, number, guessing, game

  1. Make An Online Game To Earn Money
    Mainly for students (2)
  2. Java Game
    (2)
    Hi, I'm interested in game creation on websites. The game should be playable via web browser.
    I'm not new in programing, I know C++, C# and OpenGL api. But I'm new on Java. So I have
    some questions I want to ask You: Will I'l be able to create simple 2d game with java which
    would be playable via web browser? Simple 2d game means: timers, images, animated sprites, in game
    font. Will I'l be able to use OpenGL? Or I should use something different? Does Trap17 suports
    java graphics features I want? Thank You for Your time and answers.....
  3. What Game Are You Playing Now?
    (4)
    Come on guys share the game are you playing now, and a few points on what you found interesting in
    the game. Right now I'm playing NFS Pro Street, this game has excellent graphics and for the
    first time in the NFS series comes with damage effects. I'm still missing the adrenalin rush
    from NFS Most Wanted. Next I'm planning to play Gears of War, Call of Duty 4 and Time Shift....
  4. Come Play Criminal-life!
    Its a cool new game! (2)
    I am here advertising a game that was made a little while back and is in the early stages of
    development! So come play with us! It is a fun community, and is almost very active. With
    your help you can help us become very active! Click here to play Criminal-Life! Thanks
    all!....
  5. What Game Is This?
    What game is this? (2)
    Quick question what game is this ? or who makes it anyone can answer this please? /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> thanks
    http://i131.photobucket.com/albums/p320/ch...armi/sp84_1.jpg ....
  6. Halo's Heritage
    (The game designers were Sci-Fi fans) (2)
    I recently noticed that there is a thread about the Halo books. Perhaps you find these books
    interesting to read-- that they add a fun element to the game. But if you really like the game, then
    I submit to you that there are better books to read. You see, the game designers of Halo were
    sci-fi fans. The original Halo (and its offspring) was quite obviously based off of two sci-fi
    classics. These books are Ringworld , by Larry Niven, and Starship Troopers , by Robert A.
    Heinlein. Ringworld won the 1970 Hugo, Nebula, and Locus awards. Larry Niven imagined a ring-shap....
  7. My New Game
    What Do You Think? (7)
    My Game what you think?....
  8. What Would Life Be Like Without Game Consoles/handhelds?
    We always ask this question about computers, so why not Games? (12)
    We always ask what life would be like without computers, but did we ever stop to think what our life
    would be like if the other stuff we took for granted wasn't here anymore? There are
    practically thousands of things that our life might feel empty without, so maybe we should start
    asking this question for those things too? I know there are a lot of Gamers out there, some of
    which couldn't last a minute if they didn't have their PS3 or XBox 360 or whatever console
    they have within standing distance of them. And I know there are many of you who are not so ha....
  9. Ea Announced Their Worst Idea Ever
    Install a game 3 times and then you have to buy another copy (9)
    I can't believe how stupid EA can be. So if you buy a game and install it over 3 times, it locks
    up and you have to buy another copy. This is STUPID. I've read in a forum a post by someone who
    formats his hard drive every 3 months. He's never going to buy any EA game with that kind of
    protection. I think it's pretty dumb too. Imagine buying the game, installing it and having it
    corrupted after a month or so. You get to fix it, re-install the game then it breaks down
    completely. Then you buy a new HD and you install it. What happens if you for some reaso....
  10. Text Based Rpg Game Maker
    (3)
    Well I need one, if you can help please do...I would like it so I can have people play online.....
  11. Favorite Sports Game...
    (5)
    What is your favorite sports game/franchise. I think Madden. I mean it sounds a bit like you
    don't play them saying Madden but they really keep bringing them out. Plus, I can just use one
    game and trade players to get teams for the next year /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" />....
  12. Metal Gear Solid 4: Guns Of The Patriots
    Will it be THE BEST GAME EVER?? What do U think? (7)
    First of all Hello every one /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" /> I'm new there and this is my first post:) I'm a great fan of MGS
    series. Less than 330 houres from the time that i'm writing this txt one of my great dream will
    come true... 12th June is the day of worldwide premiere of METAL GEAR SOLID 4 . Do U think that
    this game can get the title of " Big Boss " of all games this genre? I really like to know your
    opinion /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> ....
  13. A Game In The Works, Still Need A Name
    (4)
    So i'm at it again.. Heres what i have so far. Tech Items All tech armors will have bonus
    armor points Bonus armor points are to be used as one time hit points Some have more armor
    points, some have more abilities possibility of chance to avoid armor locations, for com penalty
    Speed Burst bonus scatter vs lob bonus to charge Reroll Hit armor Ranged Deflection Miss
    chance armor Misschance x means +(D(2x) -x) to defense Clone armor Misschance + lesser attack
    bonus(using misschance formula) Shocking Burst Set damage attack Jump Bonus to sc....
  14. Slavehack
    An online hacking GAME. (3)
    I found this game about 620 days ago whilst surfing for some *cough* stuff *cough* on the internet,
    i thought hey why not play it it can't harm me, but i was wrong, this game has taken over 600
    hours of my life away due to the addictingness of it. It's hard to get the hang of (or it was
    then because of the missing process page and the no tutorial), but now its easy. To
    'survive' in the game you need a nice set of software (currently the max is 5.0 when i
    started it was 1.5) to achieve this software you have to do riddles, once you've completed the
    ri....
  15. Game Dev Team
    Aim: to get a team together to develop an fps with scope to go mmo (4)
    Hey i'm new to these forums and i was just wandering if there are any guys or gals out there who
    wanna start making an fps in their spare time as part of a team. idealy i would love the project to
    get to the point of mmo but hey! and im easy on the dev language and any engines that may be
    used, getting a few people together to discuss would be great!....
  16. Game Creation
    (26)
    A lot of game creation costs money but there are free ones like the following: RPG Toolkit, Verge,
    Beyond Virtual Starter Kit, Dark GDK Plugin. ....
  17. Game : Mario Forever 4
    (18)
    Publisher : Buziol Game Software www.buziol.pl QUOTE Super Mario Forever is
    really a classic Mario remake. Once again you strap on your wrench and hardhat and guide the chubby
    plumber through many skillfully made levels. The diversity of the levels is very impressive. You
    will have to get through levels ranging from underwater caverns to levels filled with hot lava.
    Version 4 may include unspecified updates, enhancements, or bug fixes. Click here to download
    ....
  18. Cute Knight Review
    Girly-styled game that's really for all RPG fans (3)
    When most Western people think of consol RPGs, they generally think quests, fighting monsters, and
    set story lines. This makes games that explore the ROLE playing elements of RPGs all the more
    refreshing when they come along. Cute Knight is a game by Hanako Games , who's mission
    statement includes " girl games with unicorns instead of prom dresses ". Despite the distinctly
    feminine feel of most of their games, however, their depth and innovation can appeal to everyone.
    Cute Knight is their most recent, and best, installment. Where to find: A trial version of Cu....
  19. Some Halo Secrets
    A couple glitches in the Halo Game (3)
    Dear Halo Players, Hey there, fellow Halo fans! I thought I'd post some of my experiances
    with the odd side of Halo, and see who wants to share some of theirs! First off, on 343 Guilty
    Spark, I have found a place where, if you throw a grenade into a small crevice between the ground,
    and a big metal slab, the grenade will bounce around indefinitely, never exploding. Also, on AotC,
    before bringing the tank down the entrance to the tunnels, where the two hunters are, if you aim up
    and place a few good shots on a balcony far, far up on the far edge of the leve....
  20. Bloobs
    Fun puzzle type shooting game (5)
    Anyone heard of Bloobs ? You shoot pieces called Bloobs to form 3 bloobs. Then it clears the
    pieces. You do this until all bloobs clear off the screen. It is fun and mildly addictive. I am
    writing a guide for this game, so people can become more aware of it and play better. /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Try it and see. NOTICE: The
    page may not display properly in Opera. It will display in Avant Browser, Netscape, IE, Maxthon and
    Mozilla/SeaMonkey.....
  21. Driver!
    That oldschool Driver1 game! (18)
    Has anyone played Driver 1? They have Driv3r now, and it's not too great... but when Driver
    first came out it was an awesome driving game. Has anyone played it? I still have my copy, and
    play it every once and a while.....
  22. Google A Number?
    (44)
    when i was in 5th grade, which was 5 years ago, this was right when google first came out i think...
    anyways, i remember my 5th grade teacher telling me that the word google was the biggest number
    possible and that it was bigger than infinity. Back then i believed it but then you really think
    about it, how is a number even possibly bigger than infinity if infinity goes on FOREVER? and is
    googe EVEN a number????? anybody know?....
  23. Animaro Free Mmorpg Game!
    (7)
    AnimaRO:: Free Massive 3D Multiplayer Game www.animaro.com AnimaRO is the best server out
    there! why? ~5x/5x/5x rates! ~We NEVER wipe characters ~Custom Npcs ~Friendly Community
    ~Very friendly staff There's more! XD go to www.animaro.com and try for yourself you
    won't regret it. It's free and easy to play with a very stable server and amazing graphics
    /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> If are any
    questions about this server I'll be happy to answer them here. /biggrin.gif" sty....
  24. Are You Part Of The 2% Or The 98%?
    mind guessing game (18)
    2% or 98% of Population?Just follow these instructions, and answer the questions one at a time and
    as quickly as you can! Again, as quickly as you can but don't advance until you've done
    each of them .... really. Now, scroll down (but not too fast, you might miss something). THINK of
    a number from 1 to 10 MULTIPLY that number by 9 If the number is a 2-digit number, ADD the
    digits together Now SUBTRACT 5 DETERMINE which letter in the alphabet corresponds to the
    number you ended up with (example: 1=a, 2=b, 3=c,etc.) THINK of a country that....
  25. Favourite Final Fantasy Game
    YOUR FAVOURITE FINAL FANTASY GAME (16)
    Mine's Final Fantasy X. Tidus is the best character ever. And Blitzball ROCKS!!!....
  26. Worst Game Of All Time
    wats the baddest game of all time (60)
    I think the worst game of all time is superman for the nintendo 64 it was so stupid u had to fly
    around these rings in the first mission which made no sense the game itself was poorly done the
    powers were the only good thing and the story made no sense wat so ever so tell me wat u think is
    the worst game of all time and why....
  27. Resident Evil 4
    comments about this grat game (24)
    Hi!!! for me this is the best game ever!!! ... graphics, sound, the style
    of play ... in gamespot the rate the game 9.6 of 10!!! thats great!!! if
    you dont know anything about this games enter here
    http://www.gamespot.com/gamecube/adventure...il4/review.html check the reviews and the
    images!!! are great!!!! i want to read your comments about this
    game!!! and if you think that the story stills have relation or it is only a patch like
    many others come on !! POST!....
  28. What's Your Favorite Game System - Console
    select one from each poll (175)
    i'm a computer game fan. it's expensive but more useful. it can be use for many purpose for
    your study and entertainment. much easier to use and most common to more people.....
  29. Americas Army
    The best game ever (46)
    Americas army is awesome, its free and the game play is great. Its released by the US army, and the
    graphics are hecka good. Right now it has a few glitches, but the next patch should fix that. If u
    havent tried it already, I suggest u should!....
  30. Game Maker
    (62)
    This is one of the best free Game-making programs on the internet. It it an outstanding program with
    easy-to-use tools for beginners, and a solid flexible programming Language for advanced users.
    I've been using this program for over a year now, and I must say that it is amazing. It may not
    be as good as OpenGL C++, but it's still worth the download. You can also register if you want
    to use some of the more advanced functions, such as Multiplayer functions, DLL manipulation, and
    such. If you would like to take a look at this program, click on the link below: h....

    1. Looking for number, guessing, game, number, guessing, game

Searching Video's for number, guessing, game, number, guessing, game
advertisement



Number Guessing Game - number guessing game



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE