Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ ¹ ² ³ °
 

You are not logged in. #1 20120522 03:16:11
JAVA CODING  Implementing a methods for a gameCode:import acm.graphics.*; import acm.program.*; import java.awt.Color; import java.util.Iterator; import java.util.Random; import java.util.List; public class LAB1 { final static int BLOCKWIDTH = 50; final static int BLOCKHEIGHT = 10; final static int NBLOCKS = 10; final static int BLOCKROWS = 5; final static int ROWZERO = 50; final static int ROWSEPARATION = (5*BLOCKHEIGHT); final static int WIDTH = (BLOCKWIDTH*NBLOCKS); final static int HEIGHT = 600; public static java.util.List<acm.graphics.GRect> createPlayfield() { Random r = new Random(); List<GRect> l = null; int x = 0; int y = ROWZERO  BLOCKHEIGHT; Color c = new Color(r.nextInt(256)); addBrick(l,x,y,BLOCKWIDTH,BLOCKHEIGHT,c); for (int i = 0; i < BLOCKROWS; i++) { i = (i * ROWSEPARATION) + ROWZERO; for(int j = 0; j < NBLOCKS; j++) { j = j * BLOCKWIDTH; } } } public static void addBrick(java.util.List<acm.graphics.GRect> l, int x, int y, int width, int height, java.awt.Color c) { l.add(createBrick(x,y,WIDTH,HEIGHT,c)); } public static acm.graphics.GRect createBrick(int x, int y, int width, int height, java.awt.Color c) { GRect s = new GRect(x,y,WIDTH,HEIGHT); return s; } public static acm.graphics.GRect intersect(acm.graphics.GObject o,java.util.List<acm.graphics.GRect> l) { GRectangle r = o.getBounds(); for(GRect e : l) { if(e.getBounds().intersects(r)) return e; } return null; } Problem I have is the createPlayfield() method, I have no idea on what to do, this is the description.. #3 20120522 05:48:06
Re: JAVA CODING  Implementing a methods for a gameHi geforce; In mathematics, you don't understand things. You just get used to them. I have the result, but I do not yet know how to get it. All physicists, and a good many quite respectable mathematicians are contemptuous about proof. 