public void PassingWorks() { Bot bot = new Bot(); MoveRequest request = readMessage <MoveRequest>("{'Board':{'state':[[0,0,0,0,0,0,0,0,0],[0,15,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,-27,0,0,-7,9,0,0],[0,0,0,0,0,0,-6,0,-18],[0,0,0,0,-5,0,0,14,-5]]},'AllowedMoves':['0','1','2']}"); var allowedMoves = new MoveType[] { MoveType.Attack, MoveType.Pass, MoveType.Strengthen }; PrintableMove result = null; Assert.DoesNotThrow(() => result = bot.GetPrintableMoveWithDanger(request.Board, new Move(MoveType.Pass, null, null), allowedMoves)); Console.WriteLine("poep" + result.ToString()); }
private void CalculateSecondMove(List <PrintableMove> combinedMoves, PrintableMove firstMove) { var resultBoard = firstMove.board; GameState.CalculateGameState(resultBoard, myColor); var validNextMoves = new List <Move>(); foreach (var location in GameState.myLocations) { validNextMoves.AddRange(GameState.myPossibleToLocations[location].Select <BoardLocation, Move>(l => CreateMove(resultBoard, location, l)).Where(m => m.From != m.To)); } if (debug) { Console.WriteLine("\nSecond Moves for location: " + firstMove.ToString()); } validNextMoves.Add(new Move(MoveType.Pass, null, null)); var Moves = validNextMoves.Select(m => GetPrintableMoveWithDanger(resultBoard, m, new MoveType[] { MoveType.Attack, MoveType.Pass, MoveType.Strengthen })).OrderBy(m => m.Danger - m.Value); var bestMove = Moves.First(); firstMove.Danger = bestMove.Danger; firstMove.Value = bestMove.Value + firstMove.ValueOfAttackedStone; combinedMoves.Add(firstMove); }