void place(int mx, int my) { if (drme) { drme = false; return; } int n = data.a.length; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (((mx - data.a[i][j].x) * (mx - data.a[i][j].x) + (my - data.a[i][j].y) * (my - data.a[i][j].y) < bst.scale * bst.scale * .75) && data.a[i][j].getState() == 0) { if (count == 1 && gst.swap) { int ch = JOptionPane.showConfirmDialog( this, "Swap moves?", "Swap", JOptionPane.YES_NO_OPTION); if (ch == JOptionPane.YES_OPTION) { lmv.setState(cst); switch (cst) { case 1: data.a[i][j].setState(2); break; case 2: data.a[i][j].setState(1); break; } repaint( (int) (lmv.x - 0.8 * bst.scale), (int) (lmv.y - 0.8 * bst.scale), (int) (1.6 * bst.scale), (int) (1.6 * bst.scale)); if (AIMethods.gameOver(this, lmv.i, lmv.j, count)) { newGame(); } if (gst.ai != null) gst.ai.updateAI(lmv.i, lmv.j, lmv.getState(), count); } else data.a[i][j].setState(cst); } else data.a[i][j].setState(cst); lmv = data.a[i][j]; repaint( (int) (data.a[i][j].x - 0.8 * bst.scale), (int) (data.a[i][j].y - 0.8 * bst.scale), (int) (1.6 * bst.scale), (int) (1.6 * bst.scale)); switch (cst) { case 1: cst = 2; break; case 2: cst = 1; break; } if (AIMethods.gameOver(this, lmv.i, lmv.j, count)) { System.out.println("Game Over"); firstrun = true; String win = ""; if (lmv.getState() == Block.RED_BEAD) { switch (gst.theme) { case 0: win = "Red"; break; case 1: win = "Black"; break; case 2: win = "Gold"; break; } } else { switch (gst.theme) { case 0: win = "Blue"; break; case 1: win = "Green"; break; case 2: win = "Silver"; break; } } if (gst.audio) AePlayWave.play(AePlayWave.END); JOptionPane.showMessageDialog( this, win + " wins", "Game Over", JOptionPane.INFORMATION_MESSAGE); newGame(); return; } if (gst.audio) { if (gst.ai == null) AePlayWave.play(AePlayWave.PLACE); else if (userMove) AePlayWave.play(AePlayWave.AIMOVE); } count++; if (gst.ai != null && userMove) { userMove = false; gst.ai.nextMove(lmv.i, lmv.j, lmv.getState(), count); } else userMove = true; return; } } } if (gst.audio) AePlayWave.play(AePlayWave.BLOCK); }