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

View File

@@ -156,6 +156,7 @@ namespace Morris
gameThread = new Thread(() => theGame.Run()); gameThread = new Thread(() => theGame.Run());
gameThread.Start(); gameThread.Start();
} }
private void white_SelectionChanged(object sender, SelectionChangedEventArgs e) private void white_SelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -205,9 +206,9 @@ namespace Morris
throw new Exception(); throw new Exception();
populateLists(new[] { assembly }); 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> /// <summary>
/// Spielt eine gesamte Runde Mühle /// Spielt eine gesamte Runde Mühle
/// </summary> /// </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> /// <returns>Das Spielergebnis</returns>
public GameResult Run() public GameResult Run()
{ {

View File

@@ -33,6 +33,11 @@ namespace Morris
Remove = remove; 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> /// <summary>
/// Erstellt einen neuen Zug, der das Setzen eines neuen Steines repräsentiert /// Erstellt einen neuen Zug, der das Setzen eines neuen Steines repräsentiert
/// </summary> /// </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 // "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)" // Felder durch gegnerische Steine besetzt sind (die Mühle also geschlossen ist)"
bool allInMill = Enumerable.Range(0, FIELD_SIZE) 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()))); .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()))) 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: case GameResult.Draw:
status.Content = "Unentschieden"; status.Content = "Unentschieden";
break; break;
case GameResult.Running:
status.Content = null;
break;
} }
}); });
} }

View File

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