Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Number Guessing Game, number guessing game
thek2kid
post Mar 7 2005, 01:20 AM
Post #1


Newbie
*

Group: Members
Posts: 1
Joined: 7-March 05
Member No.: 4,208



do you still have the code for that number guessing game?
Go to the top of the page
 
+Quote Post
biscuitrat
post Mar 7 2005, 01:45 AM
Post #2


Kween of Everything :)
***********

Group: Members
Posts: 1,052
Joined: 16-October 04
From: Houston, Tejas :D
Member No.: 1,774



Why don't you try http://www.hotscripts.com? They should have whatever you want.
Go to the top of the page
 
+Quote Post
cse-icons
post Mar 7 2005, 06:55 AM
Post #3


Super Member
*********

Group: Members
Posts: 351
Joined: 19-October 04
From: India
Member No.: 1,824



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.
Go to the top of the page
 
+Quote Post
gamingnews
post Aug 3 2005, 05:24 AM
Post #4


Newbie [Level 1]
*

Group: Members
Posts: 13
Joined: 3-August 05
Member No.: 10,211



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
Go to the top of the page
 
+Quote Post
MystiK1337
post Nov 24 2005, 09:02 PM
Post #5


Member [Level 1]
****

Group: Members
Posts: 62
Joined: 10-August 05
Member No.: 10,556



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);
  }
 }
}
}
Go to the top of the page
 
+Quote Post
limasol
post Mar 28 2006, 12:47 PM
Post #6


Newbie
*

Group: Members
Posts: 1
Joined: 28-March 06
Member No.: 20,876



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.
Go to the top of the page
 
+Quote Post
Inspiron
post Mar 28 2006, 02:42 PM
Post #7


Trap Grand Marshal Member
***********

Group: Members
Posts: 1,205
Joined: 25-March 05
Member No.: 4,883



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.
Go to the top of the page
 
+Quote Post
devintmiller
post Jul 13 2007, 07:49 PM
Post #8


Newbie
*

Group: Members
Posts: 4
Joined: 12-July 07
Member No.: 46,392



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 Attached File  15_Guess_My_Number.exe.zip ( 127.67k ) Number of downloads: 6


This post has been edited by devintmiller: Jul 13 2007, 08:10 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. A Game In The Works, Still Need A Name(3)
  2. Game : Mario Forever 4(18)
  3. What Game Are You Playing Now?(4)
  4. Favorite Sports Game...(5)
  5. Driver!(18)
  6. Make An Online Game To Earn Money(2)
  7. Game Creation(26)
  8. Slavehack(3)
  9. Google A Number?(44)
  10. Text Based Rpg Game Maker(3)
  11. Game Maker(62)
  12. Cute Knight Review(3)
  13. What's Your Favorite Game System - Console(175)
  14. Bloobs(5)
  15. Americas Army(46)
  1. Java Game(2)
  2. Animaro Free Mmorpg Game!(7)
  3. Are You Part Of The 2% Or The 98%?(18)
  4. Worst Game Of All Time(60)
  5. Favourite Final Fantasy Game(16)
  6. What Game Is This?(2)
  7. Come Play Criminal-life!(2)
  8. Resident Evil 4(24)
  9. Metal Gear Solid 4: Guns Of The Patriots(7)
  10. My New Game(7)
  11. Ea Announced Their Worst Idea Ever(9)
  12. Game Dev Team(4)