diff --git a/MiniAiCup.Paperio.Benchmark/TrajectoryFindBenchmark.cs b/MiniAiCup.Paperio.Benchmark/TrajectoryFindBenchmark.cs index 2dd76ae..fcd5b48 100644 --- a/MiniAiCup.Paperio.Benchmark/TrajectoryFindBenchmark.cs +++ b/MiniAiCup.Paperio.Benchmark/TrajectoryFindBenchmark.cs @@ -44,7 +44,57 @@ public TrajectoryFindBenchmark() "[735,765],[735,795],[735,825],[765,645],[765,675],[765,705],[765,735],[765,765],[765,795],[795,645],[795,675],[795,705]],\"lines\":[],\"position\":[675,790]," + "\"bonuses\":[]}},\"bonuses\":[],\"tick_num\":282}"; - var jState = JObject.Parse(json); + string json2 = "{\"type\":\"tick\",\"players\":{\"i\":{\"score\":589,\"direction\":\"up\",\"territory\":[[15,15],[15,45],[15,75],[15,105],[15,135],[15,165],[15,195]," + + "[15,225],[15,255],[15,285],[15,315],[15,345],[15,375],[45,15],[45,45],[45,75],[45,105],[45,135],[45,165],[45,195],[45,225],[45,255],[45,285],[45,315],[45,345],[45,375]," + + "[75,15],[75,45],[75,75],[75,105],[75,135],[75,165],[75,195],[75,225],[75,255],[75,285],[75,315],[75,345],[75,375],[105,15],[105,45],[105,75],[105,105],[105,135]," + + "[105,165],[105,195],[105,225],[105,255],[105,285],[105,315],[105,345],[105,375],[135,15],[135,45],[135,75],[135,105],[135,135],[135,165],[135,195],[135,225],[135,255]," + + "[135,285],[135,315],[135,345],[135,375],[135,405],[165,15],[165,45],[165,75],[165,105],[165,135],[165,165],[165,195],[165,225],[165,255],[165,285],[165,315],[165,345]," + + "[165,375],[165,405],[195,15],[195,45],[195,75],[195,105],[195,135],[195,165],[195,195],[195,225],[195,255],[195,285],[195,315],[195,345],[195,375],[195,405],[225,15]," + + "[225,45],[225,75],[225,105],[225,135],[225,165],[225,195],[225,225],[225,255],[225,285],[225,315],[225,345],[225,375],[225,405],[255,15],[255,45],[255,75],[255,105]," + + "[255,135],[255,165],[255,195],[255,225],[255,255],[255,285],[255,315],[255,345],[255,375],[285,15],[285,45],[285,75],[285,105],[285,135],[285,165],[285,195],[285,225]," + + "[285,255],[285,285],[285,315],[285,345],[285,375],[315,15],[315,45],[315,75],[315,105],[315,135],[315,165],[315,195],[315,225],[315,255],[315,285],[315,315],[315,345]," + + "[315,375],[345,15],[345,45],[345,75],[345,105],[345,135],[345,165],[345,195],[345,225],[345,255],[345,285],[345,315],[345,345],[345,375],[375,15],[375,45],[375,75],[375,105]," + + "[375,135],[375,165],[375,195],[375,225],[375,255],[375,285],[375,315],[375,345],[375,375],[405,45],[405,75],[405,105],[405,135],[405,195],[405,225],[405,255],[405,285]," + + "[405,315],[405,345],[405,375],[435,195],[435,225],[435,255],[435,285],[435,315],[435,345],[435,375],[465,195],[465,225],[465,255],[465,285],[465,315],[465,345],[465,375]," + + "[495,195],[495,225],[495,255],[495,285],[495,315],[495,345],[495,375],[525,195],[525,225],[525,255],[525,285],[525,315],[525,345],[525,375],[555,195],[555,225],[555,255]," + + "[555,285],[555,315],[585,285],[585,315]],\"lines\":[[285,405]],\"position\":[285,430],\"bonuses\":[]},\"2\":{\"score\":636,\"direction\":\"right\",\"territory\":[[15,405]," + + "[15,435],[15,465],[15,495],[15,525],[15,555],[15,585],[15,615],[15,645],[15,675],[15,705],[15,735],[15,765],[15,795],[15,825],[15,855],[15,885],[15,915],[45,405],[45,435]," + + "[45,465],[45,495],[45,525],[45,555],[45,585],[45,615],[45,645],[45,675],[45,705],[45,735],[45,765],[45,795],[45,825],[45,855],[45,885],[45,915],[75,405],[75,435],[75,465]," + + "[75,495],[75,525],[75,555],[75,585],[75,615],[75,645],[75,675],[75,705],[75,735],[75,765],[75,795],[75,825],[75,855],[75,885],[75,915],[105,405],[105,435],[105,465],[105,495]," + + "[105,525],[105,555],[105,585],[105,615],[105,645],[105,675],[105,705],[105,735],[105,765],[105,795],[105,825],[105,855],[105,885],[105,915],[135,435],[135,465],[135,495],[135,525]," + + "[135,555],[135,585],[135,615],[135,645],[135,675],[135,705],[135,735],[135,765],[135,795],[135,825],[135,855],[135,885],[135,915],[165,435],[165,465],[165,495],[165,525],[165,555]," + + "[165,585],[165,615],[165,645],[165,675],[165,705],[165,735],[165,765],[165,795],[165,825],[165,855],[195,435],[195,465],[195,495],[195,525],[195,555],[195,585],[195,615],[195,645]," + + "[195,675],[195,705],[195,735],[195,765],[195,795],[195,825],[195,855],[225,435],[225,465],[225,495],[225,525],[225,555],[225,585],[225,615],[225,645],[225,675],[225,705],[225,735]," + + "[225,765],[225,795],[225,825],[225,855],[255,405],[255,435],[255,465],[255,495],[255,525],[255,555],[255,585],[255,615],[255,645],[255,705],[255,735],[255,765],[255,795],[255,825]," + + "[255,855],[285,405],[285,435],[285,465],[285,495],[285,525],[285,555],[285,585],[285,615],[285,645],[285,705],[285,735],[285,765],[285,795],[285,825],[285,855],[315,405],[315,435]," + + "[315,465],[315,495],[315,525],[315,555],[315,585],[315,615],[315,645],[345,405],[345,555],[345,585],[345,615],[375,555],[375,585],[375,615],[405,585],[405,615]],\"lines\":[[165,915]," + + "[195,915],[225,915],[255,915],[285,915],[315,915],[345,915],[375,915],[405,915],[435,915],[435,885],[435,855],[435,825],[435,795],[435,765],[465,765],[465,735]],\"position\":[477,735]," + + "\"bonuses\":[{\"type\":\"n\",\"ticks\":41}]},\"4\":{\"score\":763,\"direction\":\"left\",\"territory\":[[525,15],[525,45],[525,75],[525,105],[525,135],[525,165],[555,15],[555,45]," + + "[555,75],[555,105],[555,135],[555,165],[585,15],[585,45],[585,75],[585,105],[585,135],[585,165],[585,195],[585,225],[585,255],[615,15],[615,45],[615,75],[615,105],[615,135]," + + "[615,165],[615,195],[615,225],[615,255],[615,285],[645,15],[645,45],[645,75],[645,105],[645,135],[645,165],[645,195],[645,225],[645,255],[645,285],[675,15],[675,45],[675,75]," + + "[675,105],[675,135],[675,165],[675,195],[675,225],[675,255],[675,285],[705,15],[705,45],[705,75],[705,105],[705,135],[705,165],[705,195],[705,225],[705,255],[705,285],[735,15]," + + "[735,45],[735,75],[735,105],[735,135],[735,165],[735,195],[765,45],[765,75],[765,105],[765,135]],\"lines\":[[795,45],[795,15],[825,15],[855,15],[885,15],[885,45],[885,75]," + + "[885,105],[885,135],[885,165],[885,195],[885,225],[885,255],[885,285],[915,285],[915,315],[915,345],[915,375],[915,405],[885,405],[855,405],[855,435],[825,435],[795,435]," + + "[765,435],[765,465],[735,465],[705,465],[705,435],[675,435],[675,405],[645,405],[615,405],[585,405],[585,375],[555,375],[525,375]],\"position\":[500,375],\"bonuses\":[]}," + + "\"5\":{\"score\":704,\"direction\":\"right\",\"territory\":[[345,435],[345,465],[345,495],[345,525],[375,405],[375,435],[375,465],[375,495],[375,525],[405,405],[405,435]," + + "[405,465],[405,495],[405,525],[405,555],[435,405],[435,435],[435,465],[435,495],[435,525],[435,555],[435,585],[465,405],[465,435],[465,465],[465,495],[465,525],[465,555]," + + "[465,585],[495,405],[495,435],[495,465],[495,495],[495,525],[495,555],[495,585],[525,405],[525,435],[525,465],[525,495],[525,525],[525,555],[525,585],[555,345],[555,375]," + + "[555,405],[555,435],[555,465],[555,495],[555,525],[555,555],[555,585],[585,345],[585,375],[585,405],[585,435],[585,465],[585,495],[585,525],[585,555],[585,585],[615,315]," + + "[615,345],[615,375],[615,405],[615,435],[615,465],[615,495],[615,525],[615,555],[645,315],[645,345],[645,375],[645,405],[645,435],[645,465],[645,495],[645,525],[645,555]," + + "[675,315],[675,345],[675,375],[675,405],[675,435],[675,465],[675,495],[675,525],[675,555],[675,585],[675,615],[675,645],[705,315],[705,345],[705,375],[705,405],[705,435]," + + "[705,465],[705,495],[705,525],[705,555],[705,585],[705,615],[705,645],[735,225],[735,255],[735,285],[735,315],[735,345],[735,375],[735,405],[735,435],[735,465],[735,495]," + + "[735,525],[735,555],[735,585],[735,615],[735,645],[765,15],[765,165],[765,195],[765,225],[765,255],[765,285],[765,315],[765,345],[765,375],[765,405],[765,435],[765,465],[765,495]," + + "[765,525],[765,555],[765,585],[765,615],[795,15],[795,45],[795,75],[795,105],[795,135],[795,165],[795,195],[795,225],[795,255],[795,285],[795,315],[795,345],[795,375],[795,405]," + + "[795,435],[795,465],[795,495],[795,525],[795,555],[825,15],[825,45],[825,75],[825,105],[825,135],[825,165],[825,195],[825,225],[825,255],[825,285],[825,315],[825,345],[825,375]," + + "[855,15],[855,45],[855,75],[855,105],[855,135],[855,165],[855,195],[855,225],[855,255],[855,285],[855,315],[855,345],[855,375],[885,15],[885,45],[885,75],[885,105],[885,135]," + + "[885,165],[885,195],[885,225],[885,255],[885,285],[885,315],[885,345],[885,375],[915,15],[915,45],[915,75],[915,105],[915,135],[915,255],[915,285],[915,315],[915,345]]," + + "\"lines\":[[615,585],[615,615],[615,645],[615,675],[615,705],[645,705],[645,735]],\"position\":[660,735],\"bonuses\":[]}},\"bonuses\":[{\"type\":\"n\",\"position\":[105,345]," + + "\"active_ticks\":50},{\"type\":\"saw\",\"position\":[105,645],\"active_ticks\":20},{\"type\":\"s\",\"position\":[405,165],\"active_ticks\":30},{\"type\":\"saw\",\"position\":[765,165]," + + "\"active_ticks\":20},{\"type\":\"saw\",\"position\":[885,315],\"active_ticks\":10},{\"type\":\"n\",\"position\":[705,855],\"active_ticks\":20},{\"type\":\"n\",\"position\":[675,555]," + + "\"active_ticks\":10},{\"type\":\"s\",\"position\":[735,705],\"active_ticks\":30},{\"type\":\"saw\",\"position\":[435,105],\"active_ticks\":50},{\"type\":\"n\",\"position\":[735,525]," + + "\"active_ticks\":10}],\"tick_num\":1044}"; + + var jState = JObject.Parse(json2); var state = ParseGameState(jState); _initialState = new GameStateInternal(state); } @@ -55,7 +105,7 @@ public TrajectoryFindBenchmark() public static GameState ParseGameState(JObject jParams) { return new GameState { - Players = jParams["players"].Cast().Select(x => ParsePlayer(x)).ToArray(), + Players = jParams["players"].Cast().Select(ParsePlayer).ToArray(), Bonuses = jParams["bonuses"].Cast().Select(ParseBonus).ToArray(), TickNumber = (int)jParams["tick_num"] };