RandomWalk -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //************************************************* // RandomWalk.java // // Methods to simulate a 2-dimensional random walk // on a square platform. //************************************************* public class RandomWalk { private int x, y; private int maxSteps; private int steps; private int boundary; private int maxDistance; //--------------------------------------------- // Initialize number of steps in walk & size of platform. // Initial position is at center of platform. //--------------------------------------------- public RandomWalk(int max, int edge) { maxSteps = max; boundary = edge; x = 0; y = 0; steps = 0; maxDistance = 0; } //--------------------------------------------- // Initialize number of steps in walk, size of platform // and initial position. //--------------------------------------------- public RandomWalk(int max, int edge, int startX, int startY) { maxSteps = max; boundary = edge; x = startX; y = startY; steps = 0; maxDistance = 0; } //---------------------------------------------...
View Full Document

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Page1 / 3

RandomWalk -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online