Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i code this simple game?

Status
Not open for further replies.

masterecosse

Programmer
Nov 21, 2002
1
GB
I need details or solutions in code to create this simple game...can anyone help me?
heres what i need to do:

create a java program which will play the following guessing game:
The user has to guess a code consisting of 3 characters in the range of 'a'-'e' which have

been generated at random by the computer,but in such a way that all 3 characters are

different.When the user inputs a guess the computer will print the number of bulls (i.e.

characters correct and in the right position) and the number of hits (i.e. characters

correct but in the wrong position).For example if the code to be guessed is 'adc' and 'cda'

is input then the output would be 1 'bull' and 2 hits.This process continues with the user

winning if he/she guesses correctly in a maximum of 4 guesses,otherwise the computer wins.In

addition the user may give up at any point-this should be implemented with a button and will

also count as a win for the computer.If the user loses the game,the code will be

displayed.At the end of each game the winner will be identified.
The program should validate the input guess-in particular it should reject any guess in

which 2 or more of the characters are the same.Characters outside the range 'a'-'e' should

also be rejected.Guesses consisting of wrong number of characters should also be rejected.In

each case an appropriate error message should be displayed in a dialog box and the user will

then input another guess.Guesses may be input in either upper or lower case,or any

combination of the 2.
While the game is being played the score will be displayed i.e. the number of games won by

the user and the computer.The user will also be given the option of running the program in

debug mode - if this is chosen then the code to be guessed will be displayed on the screen

while the game is being played.
the program must be developed as a gui using jbuilders visual designer.
Also a level of difficulty choice - easy,medium,difficult must be offered-

mode :'easy': range of chars:'a-d' number of chars:'3' number of turns:'5'
mode :'moderate': range of chars:'a-e' number of chars:'3' number of turns:'4'
mode :'difficult': range of chars:'a-g' number of chars:'4': number of turns:'6'

thanks to anyone with the patience..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top