Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

Reversi game help

$
0
0

I'm trying to write an Othello game.

I wrote some code to check if a square is a legal move:

    // checks if black can move somewhere
    static boolean isLegalMove(Board board, int squareNumber) {
        int startX = squareNumber % 8, startY = squareNumber / 8;
        if (board.boardColors[startX][startY] != 'e') return false;

        char[] string = new char[80];

        for (int dy = -1; dy <= 1; dy++)
            for (int dx = -1; dx <= 1; dx++) {
                // keep going if both velocities are zero
                if (dy == 0 && dx == 0) continue;
                string[0] = 0;

                //////////////////////
                for (int ctr = 1; ctr < 8; ctr++) {
                    int x = startX + ctr * dx …

Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>