shogi.BB_SQUARES [0b000 ・ ・ ・ 0001, 0b000 ・ ・ ・ 0010, 0b000 ・ ・ ・ 0100, ・ ・ ・, 0b100 ・ ・ ・ 0000]. 81 elements.
shogi.COLORS Range (0, 2). 0,1.
shogi.CSA.Parser.parse_file(filepath) It is converted from a CSA file to a dictionary with four keys: names, sfen, moves, and win. This dictionary is included in the list as an element. If you add [0] after (filepath), you can retrieve only the dictionary.
shogi.PIECE_TYPES_WITH_NONE Range (0, 16). 0,1, ..., 15.0 is blank, and 1 and later indicate the type of piece.
shogi.MAX_PIECES_IN_HAND [0, 18, 4, 4, 4, 4, 2, 2, 0, 0, 0, 0, 0, 0, 0]. The meaning of the number of pieces you have. Indexes 1-7 probably look like this: shogi.MAX_PIECES_IN_HAND [1] = 18: Ayumu shogi.MAX_PIECES_IN_HAND [2] = 4: Lance shogi.MAX_PIECES_IN_HAND [3] = 4: Keima shogi.MAX_PIECES_IN_HAND [4] = 4: Silver shogi.MAX_PIECES_IN_HAND [5] = 4: Fri shogi.MAX_PIECES_IN_HAND [6] = 2: Corner shogi.MAX_PIECES_IN_HAND [7] = 2: Rook
shogi.SQUARES Range (0, 81).
from_square A variable that represents the movement source when the board surface is represented by a numerical value from 0 to 80. The quotient when divided by 9 is the y coordinate, and the remainder is the x coordinate. The xy coordinate is 0 origin.
x coordinate
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8 0 y coordinates
9 10 11 12 13 14 15 16 17 1
18 19 20 21 22 23 24 25 26 2
27 28 29 30 31 32 33 34 35 3
36 37 38 39 40 41 42 43 44 4
45 46 47 48 49 50 51 52 53 5
54 55 56 57 58 59 60 61 62 6
63 64 65 66 67 68 69 70 71 7
72 73 74 75 76 77 78 79 80 8
to_square Same as above (destination).
A class that represents an aspect. By the way, you can display the board in two dimensions with print (board).
piece_bb An array of 15 elements. Each element indicates the arrangement of each piece. 0: blank, 1: step, 2: incense, ... bit board. The bit board is as follows. Each element is a decimal number display of 81 digits (= 81 squares) in binary (that is, bit board). If you want to display 81 decimal digits, you can print ('{: 0 = 81b}'. format (decimal value)).
occupied An array of two elements. Each element is the position of the piece occupied by the first move and the second move. bit board.
pieces_in_hand An array of two elements. Each element is a dictionary type that shows which piece (= key) and how many pieces (= value) the first move and the second move have.
Recommended Posts