From ec1f8f803e66b993c11d00ccae9214f031f39549 Mon Sep 17 00:00:00 2001 From: Markus Himmel Date: Mon, 29 Aug 2016 21:28:25 +0200 Subject: [PATCH] Changes accommodating Malom2Morris --- ExternalBotTest/ExternalBotTest.fsproj | 12 +++++++++--- Morris/Controller.xaml.cs | 5 +++-- Morris/Game.cs | 3 --- Morris/GameMove.cs | 5 +++++ Morris/GameState.cs | 2 +- Morris/GameWindow.xaml.cs | 4 ++++ Morris/Morris.csproj | 4 ++-- 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ExternalBotTest/ExternalBotTest.fsproj b/ExternalBotTest/ExternalBotTest.fsproj index 27ab13c..c249a44 100644 --- a/ExternalBotTest/ExternalBotTest.fsproj +++ b/ExternalBotTest/ExternalBotTest.fsproj @@ -23,6 +23,7 @@ DEBUG;TRACE 3 bin\Debug\ExternalBotTest.XML + x64 pdbonly @@ -32,11 +33,9 @@ TRACE 3 bin\Release\ExternalBotTest.XML + x64 - - D:\Users\marku\Documents\Visual Studio 2015\Projects\Morris\Morris\bin\Debug\Morris.exe - True @@ -50,6 +49,13 @@ + + + Morris + {e3ccb2e8-5840-4442-8a66-177f5df4c4f5} + True + + 11 diff --git a/Morris/Controller.xaml.cs b/Morris/Controller.xaml.cs index 9afbbe1..cfefef7 100644 --- a/Morris/Controller.xaml.cs +++ b/Morris/Controller.xaml.cs @@ -156,6 +156,7 @@ namespace Morris gameThread = new Thread(() => theGame.Run()); gameThread.Start(); + } private void white_SelectionChanged(object sender, SelectionChangedEventArgs e) @@ -205,9 +206,9 @@ namespace Morris throw new Exception(); populateLists(new[] { assembly }); } - catch (Exception) + catch (Exception ex) { - MessageBox.Show("Assembly konnte nicht geladen werden."); + MessageBox.Show($"Assembly konnte nicht geladen werden: {ex.Message} ({ex.GetType().ToString()})"); } } diff --git a/Morris/Game.cs b/Morris/Game.cs index c964747..69d136d 100644 --- a/Morris/Game.cs +++ b/Morris/Game.cs @@ -62,9 +62,6 @@ namespace Morris /// /// Spielt eine gesamte Runde Mühle /// - /// Die Zeit, in Millisekunden, die gewartet wird, bevor nach einem - /// erfolgreichem Zug der nächste Zug angefordert wird (damit KI vs. KI-Spiele in einem - /// angemessenen Tempo angesehen werden können) /// Das Spielergebnis public GameResult Run() { diff --git a/Morris/GameMove.cs b/Morris/GameMove.cs index ffae968..e7f291f 100644 --- a/Morris/GameMove.cs +++ b/Morris/GameMove.cs @@ -33,6 +33,11 @@ namespace Morris Remove = remove; } + public override string ToString() + { + return $"{(!From.HasValue ? string.Empty : CoordinateTranslator.HumanReadableFromID(From.Value) + "-")}{CoordinateTranslator.HumanReadableFromID(To)}{(Remove.HasValue ? "," + CoordinateTranslator.HumanReadableFromID(Remove.Value) : string.Empty)}"; + } + /// /// Erstellt einen neuen Zug, der das Setzen eines neuen Steines repräsentiert /// diff --git a/Morris/GameState.cs b/Morris/GameState.cs index 75f4a94..f39043a 100644 --- a/Morris/GameState.cs +++ b/Morris/GameState.cs @@ -271,7 +271,7 @@ namespace Morris // "Für alle gegnerischen Steine gilt, dass eine Mühle existiert, die diesen Stein enthält und von der alle // Felder durch gegnerische Steine besetzt sind (die Mühle also geschlossen ist)" bool allInMill = Enumerable.Range(0, FIELD_SIZE) - .Where(point => (int)Board[point] != (int)NextToMove.Opponent()) + .Where(point => (int)Board[point] == (int)NextToMove.Opponent()) .All(point => Mills.Any(mill => mill.Contains(point) && mill.All(mp => (int)Board[point] == (int)NextToMove.Opponent()))); if (!allInMill && Mills.Any(mill => mill.Contains(move.Remove.Value) && mill.All(point => (int)Board[point] == (int)NextToMove.Opponent()))) diff --git a/Morris/GameWindow.xaml.cs b/Morris/GameWindow.xaml.cs index 0f7482b..8526ff4 100644 --- a/Morris/GameWindow.xaml.cs +++ b/Morris/GameWindow.xaml.cs @@ -176,6 +176,10 @@ namespace Morris case GameResult.Draw: status.Content = "Unentschieden"; break; + + case GameResult.Running: + status.Content = null; + break; } }); } diff --git a/Morris/Morris.csproj b/Morris/Morris.csproj index 4d7bf93..309f856 100644 --- a/Morris/Morris.csproj +++ b/Morris/Morris.csproj @@ -15,7 +15,7 @@ true - AnyCPU + x64 true full false @@ -25,7 +25,7 @@ 4 - AnyCPU + x64 pdbonly true bin\Release\