public void MiddleActionEasy(BoardController boardController, int myColor, int rivalColor) { (int x, int z)? candidatePos = null; GoSituations[] single = boardController.HasLines(1); GoSituations[] preReachLines = boardController.HasLines(2); 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); } } //相手の2連ラインがあればそれを邪魔する if (candidatePos == null) { GoSituations[] rivalPreReachLines = preReachLines.Where(item => item.BoardStatus == rivalColor).ToArray(); candidatePos = middleBehavior.PutPreReachLine(rivalPreReachLines, boardController); } //孤立している自身の碁があれば2連を作りに行く if (candidatePos == null) { single = single.Where(item => item.BoardStatus == myColor).ToArray(); candidatePos = middleBehavior.MakePreReachLine(single, boardController); } //自身の2連ラインがあればリーチを作りに行く if (candidatePos == null) { GoSituations[] myPreReachLines = preReachLines.Where(item => item.BoardStatus == myColor).ToArray(); candidatePos = middleBehavior.PutPreReachLine(myPreReachLines, boardController); } //上記いずれの処理も実行しなかった場合、ランダムな位置に置く if (candidatePos == null) { candidatePos = commonBehavior.NoPlan(boardController.VacantPos()); } boardController.AddGo(candidatePos.Value.x, candidatePos.Value.z, myColor); }