Question: Java program I have the following track, and would like the program to register that the car is crashed, when it is outside the lines.
Java program
I have the following "track", and would like the program to register that the car is crashed, when it is outside the lines. So I got it working for a simple track by using StdDraw.text(size/2, size/2, "You crashed!"), when the terms were met, but am having issues handling this one. If anyone can show me hot to remove the grid outside the track, that would be great too!



public static void track2O i 235 236 237 int scale = 10; int n - 4*scale; // The final size of the field 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 StdDraw. setCanvasSize(800, 800); // Adjust the size of the window StdDraw. setScale(0,n); /I Set size of the coordinate system StdDraw.clearQ; StdDraw. setPenColor(StdDraw. LIGHT_GRA); StdDraw. filledSquare(n/2.0, n/2.0, n/2.0); StdDraw.setPenColor(StdDraw. BLACK); StdDraw.setPenRadius(9.0/((double)n*50.0)); StdDraw. square(n/2.0, n/2.0,n/2.0); StdDraw. setPenRadius(4.0/((double)n*100.0)); for(int i = 1; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
