SHARE
TWEET

Untitled

a guest Aug 8th, 2012 31 Never
  1. for(int randomValue=(int) Math.round(Math.random()*100), numberGuessed=-1, introMessage=0;
  2.         numberGuessed !=randomValue;
  3.         System.out.println(Integer.toString(introMessage).replace("0", "Pick a number from 1 to 100").replace("2","------")),
  4.                 System.out.println(Integer.toString(introMessage).replace("0","------").replace("2","Not quite there! Your number is " + Integer.toString(Integer.signum(numberGuessed-randomValue)).substring(0,1).replace("1", "over").replace("-", "under") + " the real value")),
  5.                 introMessage=2,numberGuessed=Integer.parseInt((new java.util.Scanner(System.in)).nextLine()),
  6.                 System.out.println(Integer.toString(Integer.signum(numberGuessed - randomValue)).substring(0,1).replace("0", "YOU WIN!").replace("1", "Pick a number from 1 to 100").replace("-", "Pick a number from 1 to 100"))
  7. );
RAW Paste Data
Top