Package chesstrainer.util

Examples of chesstrainer.util.ESide


        drawArrows((Graphics2D)g, size);
    }
   
    private void drawSquares(Graphics2D g, int size) {
        int x, y;
        ESide color;
        for (ESquare square : ESquare.values()) {
            color = square.getColor();
            x = getX(square, size);
            y = getY(square, size);
            if (color == ESide.WHITE) {
View Full Code Here


       
    }
   
    private static Set<CMove> getKnightMoves(CPosition position, ESquare square) {
        Set<CMove> moves = new HashSet<>();
        ESide side = position.get(square).getSide();
       
        for (ESquare s : new ESquare[]{square.knight1(), square.knight2(),
            square.knight3(), square.knight4(), square.knight5(), square.knight6(),
            square.knight7(), square.knight8()}) {
           
View Full Code Here

        return moves;
    }
   
    private static Set<CMove> getBishopMoves(CPosition position, ESquare square) {
        Set<CMove> moves = new HashSet<>();
        ESide side = position.get(square).getSide();
        ESquare s;
       
        s = square;
        while (s.nw() != null) {
            s = s.nw();
View Full Code Here

        return moves;
    }
   
    private static Set<CMove> getRookMoves(CPosition position, ESquare square) {
        Set<CMove> moves = new HashSet<>();
        ESide side = position.get(square).getSide();
        ESquare s;
       
        s = square;
        while (s.n() != null) {
            s = s.n();
View Full Code Here

        return moves;
    }
   
    private static Set<CMove> getKingMoves(CPosition position, ESquare square) {
        Set<CMove> moves = new HashSet<>();
        ESide side = position.get(square).getSide();
       
        for (ESquare s : new ESquare[]{square.n(), square.ne(), square.e()
            , square.se(), square.s(), square.sw(), square.w(), square.nw()}) {
           
            if (s != null) {
View Full Code Here

   
    private static Set<CMove> retainLegalMoves(CPosition position, Set<CMove> moves) {
       
        CPosition pos;
        Set<CMove> legalMoves = new HashSet<>();
        ESide side = position.getSideToMove();
       
        for (CMove move : moves) {
            if (side != position.getPosition().get(move.getFrom()).getSide()) {
                continue;
            }
View Full Code Here

        return false;
    }
   
    public static boolean isInCheck(CPosition position) {
        ESquare kingSquare = null;
        ESide side = position.getSideToMove();
       
        for (ESquare s : position.getPosition().keySet()) {
            if (side == ESide.BLACK && position.get(s) == EPiece.WK) {
                kingSquare = s;
                break;
View Full Code Here

TOP

Related Classes of chesstrainer.util.ESide

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.