Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean tryToShiftRight(int x, int y) {
- int[][] gameField = model.getGameField();
- int width = model.getWidth();
- boolean result = false;
- if (x == width - 1) {
- return false;
- }
- for (int j = 0; j < 4; j++) {
- for (int i = 0; i < 4; i++) {
- /*if (j == 3) {
- if (positions[currPosition][i][j] == 1) {
- if (y - i >= 0 && x + j + 1 < width) {
- if (!(result = (gameField[y - i][x + j + 1] == Color.BLACK.getRGB()))) {
- return false;
- }
- } else {
- return false;
- }
- }
- } else {
- if (positions[currPosition][i][j] == 1 && positions[currPosition][i][j + 1] == 0) {
- if (y - i >= 0 && x + j + 1 < width) {
- if (!(result = (gameField[y - i][x + j + 1] == Color.BLACK.getRGB()))) {
- return false;
- }
- } else {
- return false;
- }
- }
- }*/
- if (positions[currPosition][i][j] == 1) {
- if (y - i >= 0 && x + j + 1 < width) {
- if (j == 3 || positions[currPosition][i][j + 1] == 0)
- if (!(result = (gameField[y - i][x + j + 1] == Color.BLACK.getRGB()))) {
- return false;
- }
- } else {
- return false;
- }
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement