Loading...


bookmark - Number Guessing Game number guessing game

Number Guessing Game - number guessing game

 
 Discussion by thek2kid with 10 Replies.
 Last Update: April 16, 2009, 2:43 am ( View Rated (1) )
 
bookmark - Number Guessing Game number guessing game  
Quickly Post to Number Guessing Game number guessing game w/o signup Share Info about Number Guessing Game number guessing game using Facebook, Twitter etc. email your friend about Number Guessing Game number guessing game Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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












   Sun Mar 6, 2005    Reply         

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

   Sun Mar 6, 2005    Reply         

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.

   Sun Mar 6, 2005    Reply         


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

   Tue Aug 2, 2005    Reply         

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);
  }
 }
}
}

   Thu Nov 24, 2005    Reply         

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.

   Tue Mar 28, 2006    Reply         


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.

   Tue Mar 28, 2006    Reply         

QUOTE (thek2kid)

do you still have the code for that number guessing game?
Link: view Post: 56986


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]

   Fri Jul 13, 2007    Reply         

I made one at school using VB. Not sure if anyone would really have any use for it though.

   Thu Jul 31, 2008    Reply         

Thanx for ur help. I was also searching for number guessing game coding. Thanx.

   Fri Aug 1, 2008    Reply         

Please can you make a jaa program to run this case study? Thanks a lot...vNumber Guessing Game

Magic Numbers Game

 

Description: The magic numbers game is a simple guessing game between a human player and a

computer. This case study should be able to do the following:

1. At the start, the program should ask the name of the player, number of rounds and game type.

Name of player can be any alphanumeric character. Number of rounds can be from 1100

and game

type has two options: 1. High and 2. Low. This is only done at the start of the game.

2. For each round, the program should generate a random number from 1 to 1000 which is not seen

by the human player. Then the human player will enter a number between 1 to 1000. If the game

type is High, one point will be given to the player who provided the higher digit. If the game type is

low, one point will be given to the player who provided the lower digit.

3. Display the score after each round. After the reaching the number of rounds, the program should

be able to declare the winner (player with the higher score) and display the final score.

4. The human player can end playing the program anytime he/she wants by pressing 'q' or 'Q'.

 

-reply by lester

 

   Thu Apr 16, 2009    Reply         

Quickly Post to Number Guessing Game number guessing game w/o signup Share Info about Number Guessing Game number guessing game using Facebook, Twitter etc. email your friend about Number Guessing Game number guessing game Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Php Guessing Script

Here's the guessing script, they guess a number and checks if they are right or wrong.. CODE <form method="guess.php?action=yes"> <input type="text" name="t_guess"> <br> <input type="submit" ...more

   30-Mar-2005    Reply         

What Is Your Favorite Online Game

What is your favorite online game and why. If you have more than one favorite game post more than one. I'll post my favority game: My favorite online game is Runescape. Its very fun and easy to understand. Runescape is rather competative, which also makes a good online game. ...more

   09-May-2005    Reply         

Good Rpg Game Besides Final Fantasy

Hi all, Does any1 know of any good RPG games for PS2 besides Final Fantasy, because i've had a hard time finding other good RPG games because only ff is good. If you know any can you please PM me or just post here. Thanks. Rock on Final Fantasy. ...more

   17-Apr-2006    Reply         

Mind Games, Mathematical Games    Mind Games, Mathematical Games (4) (2) Make Games In Delphi 7 ? Help me to mke a game!  Make Games In Delphi 7 ? Help me to mke a game!