Skip to content

Commit

Permalink
first working version, by any definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sictransit committed Sep 20, 2022
1 parent 5fa1ad8 commit f895aef
Show file tree
Hide file tree
Showing 91 changed files with 4,203 additions and 936 deletions.
21 changes: 21 additions & 0 deletions Common/Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>SicTransit.Woodpusher.Common</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Trace" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions Common/Interfaces/IEngine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using SicTransit.Woodpusher.Model;

namespace SicTransit.Woodpusher.Common.Interfaces
{
public interface IEngine
{
Board Board { get; }

void Initialize();

void Play(Move move);

void Play(AlgebraicMove algebraicMove);

AlgebraicMove PlayBestMove();
}
}
34 changes: 34 additions & 0 deletions Common/Logging.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Serilog;
using Serilog.Events;
using System.Reflection;

namespace SicTransit.Woodpusher.Common
{
public static class Logging
{
public static void EnableLogging(LogEventLevel level = LogEventLevel.Information, bool enableConsole = true)
{
var logFilename = $"{Assembly.GetCallingAssembly().GetName().Name}.log";

var loggerConfiguration = new LoggerConfiguration().MinimumLevel.Debug().Enrich.FromLogContext();

if (enableConsole)
{
loggerConfiguration = loggerConfiguration.WriteTo.Console(level);
}

Log.Logger = loggerConfiguration
.WriteTo.File(logFilename, LogEventLevel.Information)
.CreateLogger();
}

public static void EnableUnitTestLogging(LogEventLevel level = LogEventLevel.Information)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.Enrich.FromLogContext()
.WriteTo.Trace(level)
.CreateLogger();
}
}
}
22 changes: 22 additions & 0 deletions CommonTests/CommonTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>SicTransit.Woodpusher.Tests</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
</ItemGroup>

</Project>
7 changes: 0 additions & 7 deletions Engine/Engine.cs

This file was deleted.

5 changes: 5 additions & 0 deletions Engine/Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<RootNamespace>SicTransit.Woodpusher.Engine</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.12.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Parsing\Parsing.csproj" />
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions Engine/EvaluationProgress.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SicTransit.Woodpusher.Engine
{
internal class EvaluationProgress
{
public int NodeCount { get; set; }
}
}
75 changes: 0 additions & 75 deletions Engine/Movement/KingMovement.cs

This file was deleted.

55 changes: 0 additions & 55 deletions Engine/Movement/KnightMovement.cs

This file was deleted.

84 changes: 0 additions & 84 deletions Engine/Movement/PawnMovement.cs

This file was deleted.

Loading

0 comments on commit f895aef

Please sign in to comment.