Skip to content
← Back to Community
Java Number Guessing Game
Profile icon
GamrCodr

https://repl.it/@GamrCodr/Java-Guessing-Game

Java guessing game which produces a random number from 1 to 100. I tried to write this code in as few lines as possible. I am still fairly new to Java so if you notice something I could do better then please tell me! Have fun!

Voters
Profile icon
jareddecaires
Profile icon
LeoXu2
Profile icon
JoseJordan2
Profile icon
RowanLevi
Profile icon
MNofal
Profile icon
kaytchjam
Profile icon
ClaireBookworm
Profile icon
GamrCodr
Comments
hotnewtop
Profile icon
ZachariahSawye1

This could be used as a "trainer" for people to get a better understanding of a Binary decision tree.

You could expand this project by creating random range of numbers and letting the user know in advance the optimal guesses. Have the range be 2^n, where n is a small range of numbers.

Profile icon
RolandGuerriere

Some how my first guess was fifty and it told me to go lower. After trial and error the number was 72???

Profile icon
Goldmund

Looks good, but if i were you i would put a number of attempts (8 for example).