May 12, 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. number guessing game vb 2005 - 6.00 hr back.
  2. number guessing game vb - 12.61 hr back.
  3. 20 question guessing game c - 14.48 hr back.
  4. visual basic simple number guess game - 15.91 hr back.
  5. visual basic number guess game - 16.13 hr back.
  6. number guessing game - 14.49 hr back.
  7. number guess points game - 16.57 hr back.
Similar Topics

Keywords : guessing guessing


    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