Changes accommodating Malom2Morris

This commit is contained in:
Markus Himmel
2016-08-29 21:28:25 +02:00
parent ee4db90b0d
commit ec1f8f803e
7 changed files with 24 additions and 11 deletions

View File

@@ -23,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Debug\ExternalBotTest.XML</DocumentationFile>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -32,11 +33,9 @@
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Release\ExternalBotTest.XML</DocumentationFile>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Morris">
<HintPath>D:\Users\marku\Documents\Visual Studio 2015\Projects\Morris\Morris\bin\Debug\Morris.exe</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
@@ -50,6 +49,13 @@
<Compile Include="FSharpRandomBot.fs" />
<None Include="Script.fsx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Morris\Morris.csproj">
<Name>Morris</Name>
<Project>{e3ccb2e8-5840-4442-8a66-177f5df4c4f5}</Project>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>

View File

@@ -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()})");
}
}

View File

@@ -62,9 +62,6 @@ namespace Morris
/// <summary>
/// Spielt eine gesamte Runde Mühle
/// </summary>
/// <param name="moveDelay">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)</param>
/// <returns>Das Spielergebnis</returns>
public GameResult Run()
{

View File

@@ -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)}";
}
/// <summary>
/// Erstellt einen neuen Zug, der das Setzen eines neuen Steines repräsentiert
/// </summary>

View File

@@ -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())))

View File

@@ -176,6 +176,10 @@ namespace Morris
case GameResult.Draw:
status.Content = "Unentschieden";
break;
case GameResult.Running:
status.Content = null;
break;
}
});
}

View File

@@ -15,7 +15,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -25,7 +25,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>