func (s *State) UpdateCaptured(turn shogi.Turn, fu, ky, ke, gi, ki, ka, hi int) {
	idx := capturedIndex(turn)
	s.captured[idx].FU += fu
	s.captured[idx].KY += ky
	s.captured[idx].KE += ke
	s.captured[idx].GI += gi
	s.captured[idx].KI += ki
	s.captured[idx].KA += ka
	s.captured[idx].HI += hi
}
UpdateCaptured method for shogi.State interface
package logic
import (
	"fmt"
	"strings"
	"github.com/sugyan/shogi"
)
type State struct {
	board    [9][9]shogi.Piece
	captured [2]shogi.Captured
	turn     shogi.Turn
	Hash     uint64
}
func capturedIndex(turn shogi.Turn) int {
	if turn == shogi.TurnWhite {
		return 1
	}
	return 0
}
func NewInitialState() *State {
	return NewState(
		[9][9]shogi.Piece{
			{shogi.WKY, shogi.WKE, shogi.WGI, shogi.WKI, shogi.WOU, shogi.WKI, shogi.WGI, shogi.WKE, shogi.WKY},
			{shogi.EMP, shogi.WHI, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.WKA, shogi.EMP},
			{shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU, shogi.WFU},
			{shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP},
			{shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP},
			{shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP},
			{shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU, shogi.BFU},
			{shogi.EMP, shogi.BKA, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.EMP, shogi.BHI, shogi.EMP},
			{shogi.BKY, shogi.BKE, shogi.BGI, shogi.BKI, shogi.BOU, shogi.BKI, shogi.BGI, shogi.BKE, shogi.BKY},
		},
		[2]shogi.Captured{},
		shogi.TurnBlack,
	)
}
func NewState(board [9][9]shogi.Piece, captured [2]shogi.Captured, turn shogi.Turn) *State {
	hash := hasher.turn[turn]
	for i := 0; i < 9; i++ {
		for j := 0; j < 9; j++ {
			piece := board[i][j]
			if piece != shogi.EMP {
				hash += hasher.board[piece][i][j]
			}
		}
	}
	for _, turn := range []shogi.Turn{shogi.TurnBlack, shogi.TurnWhite} {
		c := captured[capturedIndex(turn)]
		for i := 0; i < c.FU; i++ {
			hash += hasher.captured[shogi.FU][turn]
		}
		for i := 0; i < c.KY; i++ {
			hash += hasher.captured[shogi.KY][turn]
		}
		for i := 0; i < c.KE; i++ {
			hash += hasher.captured[shogi.KE][turn]
		}
		for i := 0; i < c.GI; i++ {
			hash += hasher.captured[shogi.GI][turn]
		}
		for i := 0; i < c.KI; i++ {
			hash += hasher.captured[shogi.KI][turn]
		}
		for i := 0; i < c.KA; i++ {
			hash += hasher.captured[shogi.KA][turn]
		}
		for i := 0; i < c.HI; i++ {
			hash += hasher.captured[shogi.HI][turn]
		}
	}
	return &State{
		board:    board,
		captured: captured,
		turn:     turn,
		Hash:     hash,
	}
}
func (s *State) GetPiece(file, rank int) (shogi.Piece, error) {
	if file < 1 || file > 9 || rank < 1 || rank > 9 {
		return shogi.ERR, shogi.ErrInvalidPosition
	}
	return s.board[rank-1][9-file], nil
}
func (s *State) SetPiece(file, rank int, piece shogi.Piece) error {
	if file < 1 || file > 9 || rank < 1 || rank > 9 {
		return shogi.ErrInvalidPosition
	}
	prev := s.board[rank-1][9-file]
	s.board[rank-1][9-file] = piece
	if prev != shogi.EMP {
		s.Hash -= hasher.board[prev][rank-1][9-file]
	}
	s.Hash += hasher.board[piece][rank-1][9-file]
	return nil
}
func (s *State) GetCaptured(turn shogi.Turn) shogi.Captured {
	return s.captured[capturedIndex(turn)]
}