Git Product home page Git Product logo

reversi's People

Contributors

camper9993 avatar

reversi's Issues

Замечания

  1. Непонятно, почему часть изменяемых полей класса MainApp у вас статические. Вроде как из статического контекста они нигде не используются.
  2. Для типа шашки/номера игрока лучше ввести отдельный тип-перечисление.
  3. Местами не соблюдаете code style (snake_case вместо camelCase)
  4. board[3][3] = 1;
    board[4][4] = 1;
    board[3][4] = 2;
    board[4][3] = 2;

    Сейчас у вас несколько захардкоженных зависимых констант. Лучше вычислить одни из других.
  5. Код checkPossibleTurns и flipTheChip очень похож. Как минимум, создание списка направлений можно отделить от данных методов (и сделать его единственным и общим)
  6. В StatusBar тоже огромный кусок копипасты, который подсвечивает IDEA. Попробуйте порефакторить этот код.

Замечания

  1. В Board местами копипаста.

Типа такого:

if (blackChips > whiteChips) {
winner = "Black win's!";
}
if (whiteChips > blackChips)
winner = "White win's!";
if (Objects.equals(blackChips, whiteChips))
winner = "It's a tie!";

И такого:

fullBoard();
for (int x = 0;x < WIDTH;x++) {
for (int y = 0;y < HEIGHT;y++) {
if (board[x][y] == HELP) {
return;
}
}
}

  1. key = blackScore + whiteScore * (-1);
    boolean case1 = chipPlace.x == 7 && chipPlace.y == 7;
    boolean case2 = chipPlace.x == 0 && chipPlace.y == 0;
    boolean case3 = chipPlace.x == 7 && chipPlace.y == 0;
    boolean case4 = chipPlace.x == 0 && chipPlace.y == 7;
    boolean case5 = chipPlace.x == 0 && inRange(chipPlace.y);
    boolean case6 = inRange(chipPlace.x) && chipPlace.y == 7;
    boolean case7 = chipPlace.x == 7 && inRange(chipPlace.y);
    boolean case8 = inRange(chipPlace.x) && chipPlace.y == 0;
    boolean case9 = chipPlace.x == 0 && chipPlace.y == 1 || chipPlace.x == 1 && chipPlace.y == 0 || chipPlace.x == 1 && chipPlace.y == 1;
    boolean case10 = chipPlace.x == 0 && chipPlace.y == 6 || chipPlace.x == 1 && chipPlace.y == 7 || chipPlace.x == 1 && chipPlace.y == 6;
    boolean case11 = chipPlace.x == 7 && chipPlace.y == 1 || chipPlace.x == 6 && chipPlace.y == 0 || chipPlace.x == 6 && chipPlace.y == 1;
    boolean case12 = chipPlace.x == 6 && chipPlace.y == 6 || chipPlace.x == 6 && chipPlace.y == 7 || chipPlace.x == 7 && chipPlace.y == 6;
    boolean case13 = chipPlace.x == 1 && inRange(chipPlace.y);
    boolean case14 = inRange(chipPlace.x) && chipPlace.y == 6;
    boolean case15 = chipPlace.x == 6 && inRange(chipPlace.y);
    boolean case16 = inRange(chipPlace.x) && chipPlace.y == 1;
    if (currentPlayer == ChipType.BLACK) {
    if (case1 || case2 || case3 || case4)
    key += 50;
    if (case5 || case6 || case7 || case8)
    key += 25;
    if (case9 || case11 || case10 || case12)
    key -= 50;
    if (case13 || case14 || case15 || case16)
    key -= 25;
    }
    }

Это лучше хранить в какой-нибудь структуре данных, сейчас выглядит страшновато.

  1. Местами (совсем немного), не соблюдаете стиль именования переменных (x_check, y_check)

  2. private Boolean inRange(int num) {
    return num >= 2 && 5 <= num;
    }

Похоже на баг: если num >= 5, то он и >= 2. Зачем И?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.