Exemple #1
0
func (pos *TPosition) ToPrintable() string {
	var buff = ""

	for i := 0; i < square.BOARD_SIZE; i++ {
		var fenchar = piece.ToFenChar(piece.TPiece(pos[i]))
		if fenchar == ' ' {
			fenchar = '.'
		}
		buff += string(fenchar)
		if ((i + 1) % square.BOARD_WIDTH) == 0 {
			buff += "\n"
		}
	}

	buff += fmt.Sprintf("\nturn : %c , depth : %d , wkpos : %s , bkpos : %s\n",
		TurnToChar(pos.GetTurn()), pos.GetDepth(),
		square.ToAlgeb(pos.GetKingPos(piece.WHITE)),
		square.ToAlgeb(pos.GetKingPos(piece.BLACK)))

	return buff
}
Exemple #2
0
func (b *TBoard) ColorOfSq(sq square.TSquare) piece.TColor {
	return piece.ColorOf(piece.TPiece(b.Pos[byte(sq)]))
}
Exemple #3
0
func (b *TBoard) PieceAtSq(sq square.TSquare) piece.TPiece {
	return piece.TPiece(b.Pos[byte(sq)])
}