Package com.tinygo.logic

Examples of com.tinygo.logic.Board


        }
    }

    public void testNavigation() {
        DocumentedGame game = new DocumentedGame(4);
        Board board = game.board;
        try {
            assertFalse(game.prev());
            assertFalse(game.next());

            SGFNode n2w, n3b_1, n3b_2;
            // test forward/backward navigation
            game.play(3, 3, Board.BLACK);
            game.play(0, 1, Board.WHITE);
            n2w = game.kifuLastMove();
            game.play(0, 2, Board.BLACK);
            n3b_1 = game.kifuLastMove();

            assertTrue(game.prev());
            assertSame(n2w, game.kifuLastMove());
            assertEquals(board.pos(0, 1), game.lastMove);
            assertEquals(Board.BLACK, game.colorToPlay);
            assertTrue(game.next());
            assertSame(n3b_1, game.kifuLastMove());
            assertEquals(board.pos(0, 2), game.lastMove);
            assertEquals(Board.WHITE, game.colorToPlay);
            assertFalse(game.next());

            // test variant navigation
            assertTrue(game.prev());
            game.play(0, 0, Board.BLACK); // variant to 0,2
            n3b_2 = game.kifuLastMove();
            assertEquals(board.pos(0, 0), game.lastMove);
            assertFalse(game.nextVariant());
            assertTrue(game.prevVariant());
            assertSame(n3b_1, game.kifuLastMove());
            assertEquals(board.pos(0, 2), game.lastMove);
            assertFalse(game.prevVariant());
            assertTrue(game.nextVariant());
            assertSame(n3b_2, game.kifuLastMove());
            assertEquals(board.pos(0, 0), game.lastMove);

            assertEquals(Board.WHITE, game.colorToPlay);

            // check if variant option is remembered
            assertFalse(game.nextVariant());
View Full Code Here


    public void testHandicap() {
        DocumentedGame game = new DocumentedGame(9);
        game.setHandicap(4);
        try {
            DocumentedGame newGame = new DocumentedGame(game.kifuHead());
            Board board = newGame.board;
            int pos;
            pos = board.hoshi(Board.HOSHI_NW);
            assertEquals(Board.BLACK, board.get(pos));
            pos = board.hoshi(Board.HOSHI_NE);
            assertEquals(Board.BLACK, board.get(pos));
            pos = board.hoshi(Board.HOSHI_SW);
            assertEquals(Board.BLACK, board.get(pos));
            pos = board.hoshi(Board.HOSHI_SE);
            assertEquals(Board.BLACK, board.get(pos));
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected!");
        }
    }
View Full Code Here

import junit.framework.TestCase;

public class BouzyMapTest extends TestCase {

    public void testAll() {
        Board board1 = new Board(9);
        board1.set(3, 4, Board.BLACK);
        board1.set(5, 4, Board.BLACK);
        BouzyMap bmap1 = new BouzyMap(board1);

        Board board2 = new Board(9);
        board2.set(3, 4, Board.WHITE);
        board2.set(5, 4, Board.WHITE);
        BouzyMap bmap2 = new BouzyMap(board2);

        bmap1.eval(1, 0);
        bmap2.eval(1, 0);
        int[] d1 = {
View Full Code Here

TOP

Related Classes of com.tinygo.logic.Board

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.