Commit bfd337e5 authored by PurkkaKoodari's avatar PurkkaKoodari

Add super mines, update colors

parent 9644c435
......@@ -143,6 +143,8 @@ public class BoardActivity extends Activity {
flags |= Tile.BASE;
if ("Mine".equals(tile.get(0)))
flags |= Tile.MINE;
if ("SuperMine".equals(tile.get(0)))
flags |= Tile.SUPER_MINE;
if ("player".equals(tile.get(3)))
flags |= Tile.PLAYER;
if ("opponent".equals(tile.get(3)))
......
......@@ -41,11 +41,13 @@ public class BoardDrawable extends Drawable {
whiteBg.setStyle(Paint.Style.FILL);
whiteBg.setColor(0xFFFFFFFF);
Paint orangeBg = new Paint(whiteBg);
orangeBg.setColor(0xFFFF6600);
orangeBg.setColor(0xFFFE8800);
Paint blueBg = new Paint(whiteBg);
blueBg.setColor(0xFF66FFFF);
blueBg.setColor(0xFF00C9E8);
Paint blackBg = new Paint(whiteBg);
blackBg.setColor(0xFF000000);
Paint purpleBg = new Paint(whiteBg);
purpleBg.setColor(0xFF9239B2);
Paint blackText = new Paint(whiteBg);
blackText.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
......@@ -63,7 +65,9 @@ public class BoardDrawable extends Drawable {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 13; y++) {
Tile t = pos.getResult().getTiles()[x][y];
if (t.isSet(Tile.MINE))
if (t.isSet(Tile.SUPER_MINE))
canvas.drawRect(x * 80, y * 80, x * 80 + 80, y * 80 + 80, purpleBg);
else if (t.isSet(Tile.MINE))
canvas.drawRect(x * 80, y * 80, x * 80 + 80, y * 80 + 80, blackBg);
else if (t.isSet(Tile.PLAYER))
canvas.drawRect(x * 80, y * 80, x * 80 + 80, y * 80 + 80, flipped ? blueBg : orangeBg);
......@@ -73,7 +77,8 @@ public class BoardDrawable extends Drawable {
canvas.drawRect(x * 80, y * 80, x * 80 + 80, y * 80 + 80, whiteBg);
canvas.drawText(String.valueOf(t.getLetter()),
x * 80 + 40 - blackText.measureText(String.valueOf(t.getLetter())) / 2,
y * 80 + 40 - blackText.ascent() / 2, t.isSet(Tile.MINE) ? whiteText : blackText);
y * 80 + 40 - blackText.ascent() / 2,
t.isSet(Tile.MINE | Tile.SUPER_MINE) ? whiteText : blackText);
}
}
if (pos.getCoordinates().length > 1) {
......
......@@ -90,7 +90,14 @@ public class Board {
private static void takeTile(Tile[][] tiles, int x, int y) {
if (x < 0 || x > 9 || y < 0 || y > 12)
return;
if (tiles[x][y].isSet(Tile.MINE)) {
if (tiles[x][y].isSet(Tile.MINE | Tile.SUPER_MINE)) {
if (tiles[x][y].isSet(Tile.SUPER_MINE)) {
tiles[x][y] = tiles[x][y].modify(0, Tile.SUPER_MINE);
takeTile(tiles, x - 1, y - 1);
takeTile(tiles, x - 1, y + 1);
takeTile(tiles, x + 1, y - 1);
takeTile(tiles, x + 1, y + 1);
}
tiles[x][y] = tiles[x][y].modify(0, Tile.MINE);
takeTile(tiles, x, y - 1);
takeTile(tiles, x - 1, y);
......
......@@ -6,6 +6,7 @@ public class Tile {
public static final int OPPONENT = 2;
public static final int MINE = 4;
public static final int BASE = 8;
public static final int SUPER_MINE = 16;
private int flags;
private char letter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment