示例#1
0
    public void EarlyActionEasy(BoardController boardController, int myColor, int rivalColor)
    {
        //リーチラインの妨害を最優先とし、それ以外はゲームにおいて要となるポジションを埋めに行く
        (int x, int z)? candidatePos = null;
        GoSituations[] reachLines = boardController.HasLines(3);

        if (reachLines != null)
        {
            GoSituations[] myReachLines    = reachLines.Where(item => item.BoardStatus == myColor).ToArray();
            GoSituations[] rivalReachLines = reachLines.Where(item => item.BoardStatus == rivalColor).ToArray();
            if (myReachLines.Length > 0)
            {
                //自身のリーチラインに碁を置ける場合は最優先でチェックメイトしにいく
                candidatePos = commonBehavior.PutReachLine(myReachLines, boardController);
            }
            if (candidatePos == null & rivalReachLines.Length > 0)
            {
                //相手のリーチラインがあればそのラインを止めに行く
                candidatePos = commonBehavior.PutReachLine(rivalReachLines, boardController);
            }
        }

        if (candidatePos == null)
        {
            //特にチェックメイトにからむラインがなければ重要ポジションを埋める
            candidatePos = earlyBehavior.PutImportantPosition(boardController);
        }

        boardController.AddGo(candidatePos.Value.x, candidatePos.Value.z, myColor);
    }