I read this blog entry by a seasoned game developer. He gives hints on how to practically come up to speed on game development. Strangely enough, he advises you to truly start at the beginning. Assignment number 1 is to write a number guessing game. My Java skills are a bit rusty. So I figured I would give it a go.
Here is the stickler. I could not recall how to generate random numbers. Sure I can look it up with Google. But a strong Java developer knows this stuff by heart. I seemed to recall Math.random once I saw it. But that is for doubles. I needed some ints. And the java.util.Random class was just what the doctor ordered.
You can instantiate the Random class without any parameters. Or you can pass a seed for the random number generated as a parameter to the constructor. Once you have a Random object, just call the nextInt method and you get a number between 0 and n-1 (n is the parameter you pass nextInt).
Now I had my number guessing program working in no time. I decided to add a little spice to the program that was not required. No I don't have Guess jeans models popping up on the screen. I just let the user keep guessing until they arrive at the solution. And I throw in some taunts as responses when you guess is wrong. Good stuff.
Check Your Subroutines - We are delivering our latest release to internal test today. Had a code review yesterday. Many issues were found. We are fixing the highest priority probl...
1 week ago