6fd971316427dd4bf5d0d58f103f9dc934c05f62
[chesshog.git] / src / main / java / org / hedgecode / chess / position / Position.java
1 /*
2  * Copyright (c) 2018. Developed by Hedgecode.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.hedgecode.chess.position;
18
19 import java.util.Map;
20
21 /**
22  *
23  *
24  * @author Dmitry Samoshin aka gotty
25  */
26 public interface Position {
27
28     Map<Square, ColorPiece> getSquares();
29
30     Map<Square, ColorPiece> getSquarePieces(Color color);
31
32     Map<Square, ColorPiece> getSquarePieces(Color color, Piece piece);
33
34     void setPiece(Color color, Piece piece, Square square);
35
36     void setPiece(ColorPiece colorPiece, Square square);
37
38     Color getMove();
39
40     void setMove(Color color);
41
42     boolean isDiagram();
43
44     Castle getCastle(Color color);
45
46     void setCastle(Color color, Castle castle);
47
48     Square getEnPassant();
49
50     void setEnPassant(Square square);
51
52     int getHalfMove();
53
54     void setHalfMove(int count);
55
56     int getFullMove();
57
58     void setFullMove(int number);
59
60     void initial();
61
62     void clear();
63
64     default void setPawn(Color color, Square square) {
65         setPiece(color, Piece.PAWN, square);
66     }
67
68     default void setPawns(Color color, Square... squares) {
69         for(Square square : squares)
70             setPiece(color, Piece.PAWN, square);
71     }
72
73     default void setKnight(Color color, Square square) {
74         setPiece(color, Piece.KNIGHT, square);
75     }
76
77     default void setBishop(Color color, Square square) {
78         setPiece(color, Piece.BISHOP, square);
79     }
80
81     default void setRook(Color color, Square square) {
82         setPiece(color, Piece.ROOK, square);
83     }
84
85     default void setQueen(Color color, Square square) {
86         setPiece(color, Piece.QUEEN, square);
87     }
88
89     default void setKing(Color color, Square square) {
90         setPiece(color, Piece.KING, square);
91     }
92
93 }