private void Awake() { data.seed = DateTime.Now.ToString(); board = new Chess.ChessBoard(); searchP1 = new CurveSearch <Chess.ChessBoard, Chess.ChessMove, ChessStrategy, ChessTactic>(board, data, strategies); searchP2 = new CurveSearch <Chess.ChessBoard, Chess.ChessMove, ChessStrategy, ChessTactic>(board, data, strategies); searchP1.PlayerOne = true; searchP2.PlayerOne = false; pieces = new VisualPiece[32]; for (int i = 0; i < 32; i++) { pieces[i] = new VisualPiece(); } boardVisualStart = -size / 2 + size / 16; nodeSize = size / 8; SpriteRenderer renderer = boardVisual.GetComponent <SpriteRenderer>(); Bounds bounds = renderer.sprite.bounds; float boundsSize = bounds.size.x; boardVisual.localScale = new Vector2(size, size) / boundsSize; UpdateBoard(); thread = new Thread(Cycle) { IsBackground = true }; //thread.Start(); }
private void Cycle() { CurveSearch <Chess.ChessBoard, Chess.ChessMove, ChessStrategy, ChessTactic> search = board.IsPlayerOneActive() ? searchP1 : searchP2; for (int i = 0; i < cycleCount; i++) { search.Cycle(); } Chess.ChessMove move = search.GetAndSetNext(); Vector2Int from = move.From, to = move.To; Debug.Log((!board.IsPlayerOneActive() ? "White" : "Black") + " from " + from + ", to " + to); }