Initial commit
This commit is contained in:
13
.idea/.idea.TicTacToe/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.TicTacToe/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/contentModel.xml
|
||||||
|
/.idea.TicTacToe.iml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
4
.idea/.idea.TicTacToe/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.TicTacToe/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
.idea/.idea.TicTacToe/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.TicTacToe/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.TicTacToe/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.TicTacToe/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
16
TicTacToe.sln
Normal file
16
TicTacToe.sln
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TicTacToe", "TicTacToe\TicTacToe.csproj", "{C98FC78F-7147-4E70-9E20-35D874531C98}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{C98FC78F-7147-4E70-9E20-35D874531C98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C98FC78F-7147-4E70-9E20-35D874531C98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C98FC78F-7147-4E70-9E20-35D874531C98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C98FC78F-7147-4E70-9E20-35D874531C98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
123
TicTacToe/ClassDiagram1.cd
Normal file
123
TicTacToe/ClassDiagram1.cd
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||||
|
<Class Name="TicTacToe.Players.AdvancedAiPlayer">
|
||||||
|
<Position X="5.75" Y="1.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AACAAAAAAEAAAAAAAAAAAAAAAAAAAgAAAAAAAEAAAAA=</HashCode>
|
||||||
|
<FileName>Players\AdvancedAiPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.BasicAiPlayer" Collapsed="true">
|
||||||
|
<Position X="7.5" Y="2.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAEAAAAE=</HashCode>
|
||||||
|
<FileName>Players\BasicAiPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.HumanPlayer" Collapsed="true">
|
||||||
|
<Position X="11.5" Y="2.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAEAAAAA=</HashCode>
|
||||||
|
<FileName>Players\HumanPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.LearnJson">
|
||||||
|
<Position X="19.25" Y="2.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAACAAAAgABAAAACAAAAA=</HashCode>
|
||||||
|
<FileName>Players\LearningAiPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.AiBrain">
|
||||||
|
<Position X="16.5" Y="3.75" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||||
|
<FileName>Players\LearningAiPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsCollectionAssociation>
|
||||||
|
<Field Name="AllOutcomes" />
|
||||||
|
</ShowAsCollectionAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.LearningAiPlayer">
|
||||||
|
<Position X="16.5" Y="0.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>QACAAAAAAAAAAACAAAAAAAAAAAAAAgAAAAAAgEAQAAE=</HashCode>
|
||||||
|
<FileName>Players\LearningAiPlayer.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsAssociation>
|
||||||
|
<Field Name="_brain" />
|
||||||
|
</ShowAsAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Players.Player">
|
||||||
|
<Position X="9.5" Y="1.25" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAAAAAQAAAAAAgAAAAAAAEAACAA=</HashCode>
|
||||||
|
<FileName>Players\Player.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsAssociation>
|
||||||
|
<Field Name="Symbol" />
|
||||||
|
</ShowAsAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Field">
|
||||||
|
<Position X="12.75" Y="4.75" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAIACAA=</HashCode>
|
||||||
|
<FileName>Field.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsAssociation>
|
||||||
|
<Field Name="State" />
|
||||||
|
</ShowAsAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.FieldStateHelper" Collapsed="true">
|
||||||
|
<Position X="15" Y="6.25" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||||
|
<FileName>Field.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Game">
|
||||||
|
<Position X="4.25" Y="4.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAgAAAAAAAAgAAAgAAABAAgAAAAAAAI=</HashCode>
|
||||||
|
<FileName>Game.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsCollectionAssociation>
|
||||||
|
<Field Name="Players" />
|
||||||
|
</ShowAsCollectionAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.Program" Collapsed="true">
|
||||||
|
<Position X="19.75" Y="7.5" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
|
||||||
|
<FileName>Program.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.TicTacToe">
|
||||||
|
<Position X="7.75" Y="4.25" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAEEAAAAAgAAAgAAABAAgAAEAAAAI=</HashCode>
|
||||||
|
<FileName>TicTacToe.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsAssociation>
|
||||||
|
<Field Name="_board" />
|
||||||
|
</ShowAsAssociation>
|
||||||
|
</Class>
|
||||||
|
<Class Name="TicTacToe.TicTacToeBoard">
|
||||||
|
<Position X="10.25" Y="4" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAEAAAABIAAAAAECAEEIAAAAAAAAQAQAAAAARAAA=</HashCode>
|
||||||
|
<FileName>TicTacToeBoard.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
<ShowAsAssociation>
|
||||||
|
<Field Name="_fields" />
|
||||||
|
</ShowAsAssociation>
|
||||||
|
</Class>
|
||||||
|
<Enum Name="TicTacToe.FieldState">
|
||||||
|
<Position X="15" Y="4.75" Width="1.5" />
|
||||||
|
<TypeIdentifier>
|
||||||
|
<HashCode>AAAAAAAAAAAAAAAAAAIAAAAAAQACAAAAAAAAAAAAAAA=</HashCode>
|
||||||
|
<FileName>Field.cs</FileName>
|
||||||
|
</TypeIdentifier>
|
||||||
|
</Enum>
|
||||||
|
<Font Name="Segoe UI" Size="9" />
|
||||||
|
</ClassDiagram>
|
||||||
53
TicTacToe/Field.cs
Normal file
53
TicTacToe/Field.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace TicTacToe
|
||||||
|
{
|
||||||
|
//TODO: Rename this
|
||||||
|
public enum FieldState
|
||||||
|
{
|
||||||
|
Empty = 0,
|
||||||
|
[Description("X")]
|
||||||
|
PlayerX = 1,
|
||||||
|
[Description("O")]
|
||||||
|
PlayerO = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Field
|
||||||
|
{
|
||||||
|
public FieldState State;
|
||||||
|
public int Round;
|
||||||
|
public char Symbol;
|
||||||
|
|
||||||
|
public Field(char sym)
|
||||||
|
{
|
||||||
|
Round = -1;
|
||||||
|
State = FieldState.Empty;
|
||||||
|
Symbol = sym;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FieldStateHelper
|
||||||
|
{
|
||||||
|
public static string GetDescription(this Enum value){
|
||||||
|
Type type = value.GetType();
|
||||||
|
string name = Enum.GetName(type, value);
|
||||||
|
if (name != null)
|
||||||
|
{
|
||||||
|
FieldInfo field = type.GetField(name);
|
||||||
|
if (field != null)
|
||||||
|
{
|
||||||
|
DescriptionAttribute attr =
|
||||||
|
Attribute.GetCustomAttribute(field,
|
||||||
|
typeof(DescriptionAttribute)) as DescriptionAttribute;
|
||||||
|
if (attr != null)
|
||||||
|
{
|
||||||
|
return attr.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
TicTacToe/Game.cs
Normal file
16
TicTacToe/Game.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using TicTacToe.Players;
|
||||||
|
|
||||||
|
namespace TicTacToe
|
||||||
|
{
|
||||||
|
abstract class Game
|
||||||
|
{
|
||||||
|
protected readonly List<Player> Players = new List<Player>();
|
||||||
|
protected readonly Dictionary<Player, int> Scores = new Dictionary<Player, int>();
|
||||||
|
public abstract void StartGame();
|
||||||
|
public abstract void DrawScore();
|
||||||
|
public abstract void CheckGameState();
|
||||||
|
public abstract void AddScore(Player player);
|
||||||
|
public abstract void AddPlayer(Player player);
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
TicTacToe/KlassenDiagramm.JPG
Normal file
BIN
TicTacToe/KlassenDiagramm.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
94
TicTacToe/Players/AdvancedAiPlayer.cs
Normal file
94
TicTacToe/Players/AdvancedAiPlayer.cs
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TicTacToe.Players
|
||||||
|
{
|
||||||
|
public class AdvancedAiPlayer : Player
|
||||||
|
{
|
||||||
|
private FieldState _enemyFieldState;
|
||||||
|
|
||||||
|
public AdvancedAiPlayer(string name, FieldState symbol) : base(name, symbol)
|
||||||
|
{
|
||||||
|
if (symbol == FieldState.PlayerO)
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MakeMove(TicTacToeBoard b)
|
||||||
|
{
|
||||||
|
int bestVal = (int) Symbol * -1000;
|
||||||
|
|
||||||
|
int bestMove = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
if (b._fields[i].State == FieldState.Empty)
|
||||||
|
{
|
||||||
|
b._fields[i].State = Symbol;
|
||||||
|
int val = MiniMax(b, -1, _enemyFieldState);
|
||||||
|
b._fields[i].State = FieldState.Empty;
|
||||||
|
if (Symbol == FieldState.PlayerX && val > bestVal)
|
||||||
|
{
|
||||||
|
bestMove = i;
|
||||||
|
bestVal = val;
|
||||||
|
}
|
||||||
|
if (Symbol == FieldState.PlayerO && val < bestVal)
|
||||||
|
{
|
||||||
|
bestMove = i;
|
||||||
|
bestVal = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int MiniMax(TicTacToeBoard b, int depth, FieldState player)
|
||||||
|
{
|
||||||
|
if (depth == 0 | b.IsGameFinished(out var winner))
|
||||||
|
{
|
||||||
|
return (int) winner;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player == FieldState.PlayerX)
|
||||||
|
{
|
||||||
|
int maxEval = int.MinValue;
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
if (b._fields[i].State == FieldState.Empty)
|
||||||
|
{
|
||||||
|
b._fields[i].State = FieldState.PlayerX;
|
||||||
|
int eval = MiniMax(b, depth - 1, FieldState.PlayerO);
|
||||||
|
b._fields[i].State = FieldState.Empty;
|
||||||
|
maxEval = Math.Max(maxEval, eval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxEval;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int minEval = int.MaxValue;
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
if (b._fields[i].State == FieldState.Empty)
|
||||||
|
{
|
||||||
|
b._fields[i].State = FieldState.PlayerO;
|
||||||
|
int eval = MiniMax(b, depth - 1, FieldState.PlayerX);
|
||||||
|
b._fields[i].State = FieldState.Empty;
|
||||||
|
minEval = Math.Min(minEval, eval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return minEval;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CleanUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
TicTacToe/Players/BasicAiPlayer.cs
Normal file
20
TicTacToe/Players/BasicAiPlayer.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TicTacToe.Players
|
||||||
|
{
|
||||||
|
public class BasicAiPlayer : Player
|
||||||
|
{
|
||||||
|
private readonly Random _random = new Random();
|
||||||
|
|
||||||
|
public BasicAiPlayer(string name, FieldState symbol) : base(name, symbol)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MakeMove(TicTacToeBoard _)
|
||||||
|
{
|
||||||
|
return _random.Next(9);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CleanUp() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
TicTacToe/Players/HumanPlayer.cs
Normal file
27
TicTacToe/Players/HumanPlayer.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TicTacToe.Players
|
||||||
|
{
|
||||||
|
public class HumanPlayer : Player
|
||||||
|
{
|
||||||
|
public HumanPlayer(string name, FieldState symbol) : base(name, symbol)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MakeMove(TicTacToeBoard _)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
bool loop;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Where do you want to put your {Symbol} ?");
|
||||||
|
var key = Console.ReadKey(true);
|
||||||
|
loop = int.TryParse(key.KeyChar.ToString(), out result);
|
||||||
|
|
||||||
|
} while (!loop);
|
||||||
|
return result-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CleanUp() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
TicTacToe/Players/LearningAiDir/ai.json
Normal file
1
TicTacToe/Players/LearningAiDir/ai.json
Normal file
File diff suppressed because one or more lines are too long
1
TicTacToe/Players/LearningAiDir/ai2.json
Normal file
1
TicTacToe/Players/LearningAiDir/ai2.json
Normal file
File diff suppressed because one or more lines are too long
169
TicTacToe/Players/LearningAiPlayer.cs
Normal file
169
TicTacToe/Players/LearningAiPlayer.cs
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
|
namespace TicTacToe.Players
|
||||||
|
{
|
||||||
|
//TODO: Rename
|
||||||
|
public class LearnJson
|
||||||
|
{
|
||||||
|
public int Weight;
|
||||||
|
public FieldState[] Board;
|
||||||
|
public int[] BoardHistory;
|
||||||
|
|
||||||
|
public IList<FieldState> GetBoardAtTime(int round)
|
||||||
|
{
|
||||||
|
var newBoard = new FieldState[9];
|
||||||
|
if (BoardHistory.Length <= round) throw new Exception("Round out of reach from BoardHistory");
|
||||||
|
for (int i = 0; i < round; i++)
|
||||||
|
{
|
||||||
|
if (BoardHistory[i] < 0) break;
|
||||||
|
newBoard[BoardHistory[i]] = Board[BoardHistory[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.AsReadOnly(newBoard);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetNextMove(int round)
|
||||||
|
{
|
||||||
|
if (BoardHistory.Length <= round + 1) throw new Exception("Round out of reach from BoardHistory");
|
||||||
|
return BoardHistory[round + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Rename
|
||||||
|
public class AiBrain
|
||||||
|
{
|
||||||
|
public List<LearnJson> AllOutcomes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Save Board history somehow
|
||||||
|
public class LearningAiPlayer : Player
|
||||||
|
{
|
||||||
|
private string _pathToLearningDir = @"E:\Programieren\csharp\TicTacToe\TicTacToe\Players\LearningAiDir\ai.json";
|
||||||
|
private int _round;
|
||||||
|
private AiBrain _brain;
|
||||||
|
private Random _random;
|
||||||
|
private FieldState _enemyFieldState;
|
||||||
|
|
||||||
|
|
||||||
|
public LearningAiPlayer(string name, FieldState symbol) : base(name, symbol)
|
||||||
|
{
|
||||||
|
_round = 0;
|
||||||
|
_random = new Random();
|
||||||
|
|
||||||
|
string allJsonText = File.ReadAllText(_pathToLearningDir);
|
||||||
|
_brain = JsonConvert.DeserializeObject<AiBrain>(allJsonText);
|
||||||
|
|
||||||
|
if (_brain is null || _brain.AllOutcomes is null)
|
||||||
|
{
|
||||||
|
_brain = new AiBrain()
|
||||||
|
{
|
||||||
|
AllOutcomes = new List<LearnJson>()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Symbol = symbol;
|
||||||
|
|
||||||
|
if (symbol == FieldState.PlayerO)
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MakeMove(TicTacToeBoard board)
|
||||||
|
{
|
||||||
|
var copyOfBoard = board.GetFieldStates();
|
||||||
|
int move;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
move = _random.Next(9);
|
||||||
|
} while (copyOfBoard[move] != FieldState.Empty);
|
||||||
|
|
||||||
|
if (_round == 0)
|
||||||
|
{
|
||||||
|
//TODO: with 2 Learning Players, they might open the file at the same time, leading to a crash
|
||||||
|
|
||||||
|
if (copyOfBoard.Where(x => x == _enemyFieldState).Count() > 0)
|
||||||
|
{
|
||||||
|
_round++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_random.Next(100) >= 95)
|
||||||
|
{
|
||||||
|
_round += 2;
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_brain is not null)
|
||||||
|
{
|
||||||
|
var allPlayedRounds = _brain.AllOutcomes.FindAll(x =>
|
||||||
|
Equals(x.GetBoardAtTime(_round), copyOfBoard));
|
||||||
|
if (_round == 0)
|
||||||
|
{
|
||||||
|
var bestOption = _brain.AllOutcomes.Aggregate((i, j) => i.Weight > j.Weight ? i : j);
|
||||||
|
if (bestOption is not null)
|
||||||
|
{
|
||||||
|
move = bestOption.GetNextMove(_round);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allPlayedRounds.Count != 0)
|
||||||
|
{
|
||||||
|
var bestOption = allPlayedRounds.Aggregate((i, j) => i.Weight > j.Weight ? i : j);
|
||||||
|
if (bestOption is not null)
|
||||||
|
{
|
||||||
|
move = bestOption.GetNextMove(_round);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_round += 2;
|
||||||
|
return move;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CleanUp()
|
||||||
|
{
|
||||||
|
_round = 0;
|
||||||
|
_random = new Random();
|
||||||
|
if (Symbol == FieldState.PlayerO)
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_enemyFieldState = FieldState.PlayerO;
|
||||||
|
}
|
||||||
|
|
||||||
|
string allJsonText = File.ReadAllText(_pathToLearningDir);
|
||||||
|
_brain = JsonConvert.DeserializeObject<AiBrain>(allJsonText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveToJson(TicTacToeBoard board)
|
||||||
|
{
|
||||||
|
var newRound = new LearnJson()
|
||||||
|
{
|
||||||
|
Board = board.GetFieldStates(),
|
||||||
|
BoardHistory = board.GetBoardHistory(),
|
||||||
|
Weight = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
var exists = _brain.AllOutcomes.FirstOrDefault(x => x.BoardHistory.SequenceEqual(newRound.BoardHistory));
|
||||||
|
if (exists != null) exists.Weight++;
|
||||||
|
else _brain.AllOutcomes.Add(newRound);
|
||||||
|
|
||||||
|
using (var file = File.CreateText(_pathToLearningDir))
|
||||||
|
{
|
||||||
|
string json = JsonConvert.SerializeObject(_brain);
|
||||||
|
file.Write(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
TicTacToe/Players/Player.cs
Normal file
19
TicTacToe/Players/Player.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
namespace TicTacToe.Players
|
||||||
|
{
|
||||||
|
public abstract class Player
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public FieldState Symbol;
|
||||||
|
|
||||||
|
//TODO: Replace Fieldstate Symbol with Char, for easier understanding <- only on construction
|
||||||
|
protected Player(string name, FieldState symbol)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Symbol = symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int MakeMove(TicTacToeBoard board);
|
||||||
|
|
||||||
|
public abstract void CleanUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
28
TicTacToe/Program.cs
Normal file
28
TicTacToe/Program.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using TicTacToe.Players;
|
||||||
|
|
||||||
|
namespace TicTacToe
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
TicTacToe ticTacToe = new TicTacToe();
|
||||||
|
Player player1 = new LearningAiPlayer("Learning", FieldState.PlayerX);
|
||||||
|
Player player2 = new AdvancedAiPlayer("MinMax", FieldState.PlayerO);
|
||||||
|
Player player3 = new BasicAiPlayer("Basic", FieldState.PlayerO);
|
||||||
|
Player player4 = new HumanPlayer("Human", FieldState.PlayerO);
|
||||||
|
|
||||||
|
ticTacToe.AddPlayer(player1);
|
||||||
|
ticTacToe.AddPlayer(player4);
|
||||||
|
|
||||||
|
//TODO: Menu
|
||||||
|
//TODO: Learning Players properties, dont reset, after more than one round = crash
|
||||||
|
|
||||||
|
ticTacToe.StartGame();
|
||||||
|
ticTacToe.DrawScore();
|
||||||
|
|
||||||
|
Console.ReadKey(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
85
TicTacToe/TicTacToe.cs
Normal file
85
TicTacToe/TicTacToe.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using TicTacToe.Players;
|
||||||
|
|
||||||
|
namespace TicTacToe
|
||||||
|
{
|
||||||
|
class TicTacToe : Game
|
||||||
|
{
|
||||||
|
private TicTacToeBoard _board;
|
||||||
|
|
||||||
|
private bool _gameFinished;
|
||||||
|
|
||||||
|
public override void AddPlayer(Player player)
|
||||||
|
{
|
||||||
|
if (Players.Count >= 2) throw new Exception("Trying to add too many Players");
|
||||||
|
Players.Add(player);
|
||||||
|
Scores.Add(player, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddScore(Player player)
|
||||||
|
{
|
||||||
|
if (Players.Contains(player))
|
||||||
|
Scores[player]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DrawScore()
|
||||||
|
{
|
||||||
|
foreach (var player in Players)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Player {player.Name}: {Scores[player]}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CleanUp()
|
||||||
|
{
|
||||||
|
foreach (var player in Players)
|
||||||
|
{
|
||||||
|
player.CleanUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CheckGameState()
|
||||||
|
{
|
||||||
|
if (!_board.IsGameFinished(out var winnerState)) return;
|
||||||
|
|
||||||
|
_gameFinished = true;
|
||||||
|
var winner = Players.FirstOrDefault(x => x.Symbol == winnerState);
|
||||||
|
if (winner is not null)
|
||||||
|
{
|
||||||
|
AddScore(winner);
|
||||||
|
var player = Players.FirstOrDefault(x => x.GetType() == typeof(LearningAiPlayer));
|
||||||
|
var learningAiPlayer = player as LearningAiPlayer;
|
||||||
|
learningAiPlayer?.SaveToJson(_board);
|
||||||
|
}
|
||||||
|
CleanUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void StartGame()
|
||||||
|
{
|
||||||
|
if (Players.Count != 2) throw new Exception("Not enough, or too many Players");
|
||||||
|
_board = new TicTacToeBoard();
|
||||||
|
_board.DrawBoard();
|
||||||
|
_gameFinished = false;
|
||||||
|
int round = 0;
|
||||||
|
|
||||||
|
while (_gameFinished is not true)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
bool placed = true;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
placed = _board.TryPlace(Players[i].MakeMove(_board), Players[i], round);
|
||||||
|
} while (!placed);
|
||||||
|
|
||||||
|
round++;
|
||||||
|
_board.DrawBoard();
|
||||||
|
CheckGameState();
|
||||||
|
if (_gameFinished) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
TicTacToe/TicTacToe.csproj
Normal file
12
TicTacToe/TicTacToe.csproj
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
209
TicTacToe/TicTacToeBoard.cs
Normal file
209
TicTacToe/TicTacToeBoard.cs
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using TicTacToe.Players;
|
||||||
|
|
||||||
|
namespace TicTacToe
|
||||||
|
{
|
||||||
|
public class TicTacToeBoard
|
||||||
|
{
|
||||||
|
public Field[] _fields = new Field[9];
|
||||||
|
|
||||||
|
public TicTacToeBoard()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _fields.Length; i++)
|
||||||
|
{
|
||||||
|
_fields[i] = new Field(Convert.ToChar((i+1).ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawBoard()
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine(
|
||||||
|
$"{_fields[0].Symbol} | " +
|
||||||
|
$"{_fields[1].Symbol} | " +
|
||||||
|
$"{_fields[2].Symbol}\n--------\n" +
|
||||||
|
$"{_fields[3].Symbol} | " +
|
||||||
|
$"{_fields[4].Symbol} | " +
|
||||||
|
$"{_fields[5].Symbol}\n--------\n" +
|
||||||
|
$"{_fields[6].Symbol} | " +
|
||||||
|
$"{_fields[7].Symbol} | " +
|
||||||
|
$"{_fields[8].Symbol}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryPlace(int pos, Player player, int round)
|
||||||
|
{
|
||||||
|
if (pos < 0 || pos > 9) return false;
|
||||||
|
if (_fields[pos].State != FieldState.Empty) return false;
|
||||||
|
|
||||||
|
switch (player.Symbol)
|
||||||
|
{
|
||||||
|
case FieldState.PlayerX:
|
||||||
|
_fields[pos].State = FieldState.PlayerX;
|
||||||
|
_fields[pos].Symbol = 'X';
|
||||||
|
_fields[pos].Round = round;
|
||||||
|
break;
|
||||||
|
case FieldState.PlayerO:
|
||||||
|
_fields[pos].State = FieldState.PlayerO;
|
||||||
|
_fields[pos].Symbol = 'O';
|
||||||
|
_fields[pos].Round = round;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Player Symbol was not recognised");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] GetBoardHistory()
|
||||||
|
{
|
||||||
|
int[] history = new int[_fields.Length];
|
||||||
|
for (int i = 0; i < history.Length; i++)
|
||||||
|
{
|
||||||
|
history[i] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
foreach (var field in _fields)
|
||||||
|
{
|
||||||
|
if (field.Round >= 0 && field.Round <= history.Length)
|
||||||
|
{
|
||||||
|
history[field.Round] = index;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return history;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsBoardFull()
|
||||||
|
{
|
||||||
|
//return !_fields.Any(x => x.State == FieldState.Empty);
|
||||||
|
bool isBoardFull = true;
|
||||||
|
foreach (var field in _fields)
|
||||||
|
{
|
||||||
|
if (field.State == FieldState.Empty)
|
||||||
|
{
|
||||||
|
isBoardFull = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isBoardFull;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Horizontal(out FieldState winner)
|
||||||
|
{
|
||||||
|
winner = FieldState.Empty;
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
FieldState first = _fields[i * 3].State;
|
||||||
|
winner = first;
|
||||||
|
if (first == FieldState.Empty) continue;
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
if (_fields[i * 3 + j].State == first)
|
||||||
|
{
|
||||||
|
if (j == 2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Vertical(out FieldState winner)
|
||||||
|
{
|
||||||
|
winner = FieldState.Empty;
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
FieldState first = _fields[i].State;
|
||||||
|
winner = first;
|
||||||
|
if (first == FieldState.Empty) continue;
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
if (_fields[j * 3 + i].State == first)
|
||||||
|
{
|
||||||
|
if (j == 2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Diagonal(out FieldState winner)
|
||||||
|
{
|
||||||
|
winner = _fields[4].State;
|
||||||
|
return _fields[4].State != FieldState.Empty &&
|
||||||
|
(_fields[0].State == _fields[4].State && _fields[4].State == _fields[8].State ||
|
||||||
|
_fields[2].State == _fields[4].State && _fields[4].State == _fields[6].State);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsGameFinished(out FieldState winner)
|
||||||
|
{
|
||||||
|
if (Horizontal(out winner))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Vertical(out winner))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Diagonal(out winner))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
winner = FieldState.Empty;
|
||||||
|
return IsBoardFull();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FieldState[] GetFieldStates()
|
||||||
|
{
|
||||||
|
var output = new FieldState[9];
|
||||||
|
int index = 0;
|
||||||
|
foreach (var field in _fields)
|
||||||
|
{
|
||||||
|
output[index] = field.State;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
/*public IList<Field> GetBoardCopy()
|
||||||
|
{
|
||||||
|
return Array.AsReadOnly(_fields);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public object GetBoardCopy()
|
||||||
|
{
|
||||||
|
return this.MemberwiseClone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBoard(IList<Field> fields)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
_fields[i] = fields[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
TicTacToe/obj/TicTacToe.csproj.nuget.dgspec.json
Normal file
74
TicTacToe/obj/TicTacToe.csproj.nuget.dgspec.json
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj",
|
||||||
|
"projectName": "TicTacToe",
|
||||||
|
"projectPath": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\zamk\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
|
||||||
|
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\zamk\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net5.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net5.0": {
|
||||||
|
"targetAlias": "net5.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net5.0": {
|
||||||
|
"targetAlias": "net5.0",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[13.0.1, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.400\\RuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
TicTacToe/obj/TicTacToe.csproj.nuget.g.props
Normal file
20
TicTacToe/obj/TicTacToe.csproj.nuget.g.props
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\zamk\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages;C:\Program Files (x86)\Microsoft\Xamarin\NuGet</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.10.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\zamk\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
<SourceRoot Include="C:\Program Files (x86)\Microsoft\Xamarin\NuGet\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
6
TicTacToe/obj/TicTacToe.csproj.nuget.g.targets
Normal file
6
TicTacToe/obj/TicTacToe.csproj.nuget.g.targets
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
121
TicTacToe/obj/project.assets.json
Normal file
121
TicTacToe/obj/project.assets.json
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"targets": {
|
||||||
|
"net5.0": {
|
||||||
|
"Newtonsoft.Json/13.0.1": {
|
||||||
|
"type": "package",
|
||||||
|
"compile": {
|
||||||
|
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"Newtonsoft.Json/13.0.1": {
|
||||||
|
"sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||||
|
"type": "package",
|
||||||
|
"path": "newtonsoft.json/13.0.1",
|
||||||
|
"files": [
|
||||||
|
".nupkg.metadata",
|
||||||
|
".signature.p7s",
|
||||||
|
"LICENSE.md",
|
||||||
|
"lib/net20/Newtonsoft.Json.dll",
|
||||||
|
"lib/net20/Newtonsoft.Json.xml",
|
||||||
|
"lib/net35/Newtonsoft.Json.dll",
|
||||||
|
"lib/net35/Newtonsoft.Json.xml",
|
||||||
|
"lib/net40/Newtonsoft.Json.dll",
|
||||||
|
"lib/net40/Newtonsoft.Json.xml",
|
||||||
|
"lib/net45/Newtonsoft.Json.dll",
|
||||||
|
"lib/net45/Newtonsoft.Json.xml",
|
||||||
|
"lib/netstandard1.0/Newtonsoft.Json.dll",
|
||||||
|
"lib/netstandard1.0/Newtonsoft.Json.xml",
|
||||||
|
"lib/netstandard1.3/Newtonsoft.Json.dll",
|
||||||
|
"lib/netstandard1.3/Newtonsoft.Json.xml",
|
||||||
|
"lib/netstandard2.0/Newtonsoft.Json.dll",
|
||||||
|
"lib/netstandard2.0/Newtonsoft.Json.xml",
|
||||||
|
"newtonsoft.json.13.0.1.nupkg.sha512",
|
||||||
|
"newtonsoft.json.nuspec",
|
||||||
|
"packageIcon.png"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"net5.0": [
|
||||||
|
"Newtonsoft.Json >= 13.0.1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"packageFolders": {
|
||||||
|
"C:\\Users\\zamk\\.nuget\\packages\\": {},
|
||||||
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {},
|
||||||
|
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet": {}
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj",
|
||||||
|
"projectName": "TicTacToe",
|
||||||
|
"projectPath": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj",
|
||||||
|
"packagesPath": "C:\\Users\\zamk\\.nuget\\packages\\",
|
||||||
|
"outputPath": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\obj\\",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"fallbackFolders": [
|
||||||
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages",
|
||||||
|
"C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"
|
||||||
|
],
|
||||||
|
"configFilePaths": [
|
||||||
|
"C:\\Users\\zamk\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config",
|
||||||
|
"C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net5.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net5.0": {
|
||||||
|
"targetAlias": "net5.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net5.0": {
|
||||||
|
"targetAlias": "net5.0",
|
||||||
|
"dependencies": {
|
||||||
|
"Newtonsoft.Json": {
|
||||||
|
"target": "Package",
|
||||||
|
"version": "[13.0.1, )"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.400\\RuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
TicTacToe/obj/project.nuget.cache
Normal file
10
TicTacToe/obj/project.nuget.cache
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "TL35zrF4IYHi2YM9fZwHFRdycdXuejjmaeh9TrvpRHnQFCTYYFQ+5S/9aHhRjDICuZMmwqLT5Chs+Qx8vMnt2g==",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj",
|
||||||
|
"expectedPackageFiles": [
|
||||||
|
"C:\\Users\\zamk\\.nuget\\packages\\newtonsoft.json\\13.0.1\\newtonsoft.json.13.0.1.nupkg.sha512"
|
||||||
|
],
|
||||||
|
"logs": []
|
||||||
|
}
|
||||||
1
TicTacToe/obj/project.packagespec.json
Normal file
1
TicTacToe/obj/project.packagespec.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
"restore":{"projectUniqueName":"E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj","projectName":"TicTacToe","projectPath":"E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\TicTacToe.csproj","outputPath":"E:\\Programieren\\csharp\\TicTacToe\\TicTacToe\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages","C:\\Program Files (x86)\\Microsoft\\Xamarin\\NuGet"],"originalTargetFrameworks":["net5.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net5.0":{"targetAlias":"net5.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net5.0":{"targetAlias":"net5.0","dependencies":{"Newtonsoft.Json":{"target":"Package","version":"[13.0.1, )"}},"imports":["net461","net462","net47","net471","net472","net48"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\5.0.400\\RuntimeIdentifierGraph.json"}}
|
||||||
Reference in New Issue
Block a user