| 40 | } |
| 41 | |
| 42 | public MemoryGame(int width, int height, long seed) { |
| 43 | /* Sets up StdDraw so that it has a width by height grid of 16 by 16 squares as its canvas |
| 44 | * Also sets up the scale so the top left is (0,0) and the bottom right is (width, height) |
| 45 | */ |
| 46 | this.width = width; |
| 47 | this.height = height; |
| 48 | StdDraw.setCanvasSize(this.width * 16, this.height * 16); |
| 49 | Font font = new Font("Monaco", Font.BOLD, 30); |
| 50 | StdDraw.setFont(font); |
| 51 | StdDraw.setXscale(0, this.width); |
| 52 | StdDraw.setYscale(0, this.height); |
| 53 | StdDraw.clear(Color.BLACK); |
| 54 | StdDraw.enableDoubleBuffering(); |
| 55 | |
| 56 | this.rand = new Random(seed); |
| 57 | } |
| 58 | |
| 59 | public String generateRandomString(int n) { |
| 60 | //TODO: Generate random string of letters of length n |