diff --git a/Morris/GameMove.cs b/Morris/GameMove.cs new file mode 100644 index 0000000..0368418 --- /dev/null +++ b/Morris/GameMove.cs @@ -0,0 +1,80 @@ +/* + * GameMove.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Repräsentiert einen potentiell ungültigen Spielzug + /// + public class GameMove + { + /// + /// Falls in dem Zug ein Stein bewegt wird, die Position des Steines vor dem Zug + /// + public int? From { get; private set; } + + /// + /// Die Position eines neuen oder bewegten Steines nach dem Zug + /// + public int To { get; private set; } + + /// + /// Falls der Zug eine Mühle schließt, die Position des infolgedessen entfernten gegnerischen Steines + /// + public int? Remove { get; private set; } + + private GameMove(int? from, int to, int? remove) + { + From = from; + To = to; + Remove = remove; + } + + /// + /// Erstellt einen neuen Zug, der das Setzen eines neuen Steines repräsentiert + /// + /// Wo der neue Stein platziert werden soll + /// Einen nicht zwangsläufig gütligen Spielzug + public static GameMove Place(int position) + { + return new GameMove(null, position, null); + } + + /// + /// Erstellt einen neuen Zug, der das Setzen eines neuen Steines und das Schließen einer Mühle repräsentiert + /// + /// Wo der neue Stein platziert werden soll + /// Welcher gegnerische Stein entfernt werden soll + /// Einen nicht zwangsläufig gültigen Spielzug + public static GameMove PlaceRemove(int position, int remove) + { + return new GameMove(null, position, remove); + } + + /// + /// Erstellt einen neuen Zug, der das Bewegen eines Steines repräsentiert + /// + /// Wo sich der Stein vor dem Zug befindet + /// Wo sich der Stein nach dem Zug befinden soll + /// Einen nicht zwangsläufig gültigen Spielzug + public static GameMove Move(int from, int to) + { + return new GameMove(from, to, null); + } + + /// + /// Erstellt einen neuen Zug, der das Bewegen eines Steines und das Schließen einer Mühle repräsentiert + /// + /// Wo sich der Stein vor dem Zug befindet + /// Wo sich der Stein nach dem Zug befindet + /// Welcher gegnerische Stein bewegt werden soll + /// Einen nicht zwangsläufig gültigen Spielzug + public static GameMove MoveRemove(int from, int to, int remove) + { + return new GameMove(from, to, remove); + } + } +} diff --git a/Morris/GameResult.cs b/Morris/GameResult.cs new file mode 100644 index 0000000..b95451b --- /dev/null +++ b/Morris/GameResult.cs @@ -0,0 +1,19 @@ +/* + * GameResult.cs + * Copyright (c) 2015 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Beschreibt, ob ein Spiel beendet ist und wie es ausgegangen ist + /// + public enum GameResult + { + Running, + WhiteVictory, + BlackVictory, + Draw + } +} diff --git a/Morris/GameState.cs b/Morris/GameState.cs new file mode 100644 index 0000000..ece2046 --- /dev/null +++ b/Morris/GameState.cs @@ -0,0 +1,36 @@ +/* + * GameState.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Morris +{ + /// + /// Repräsentiert eine Mühle-Spielsituation + /// + public class GameState + { + public Occupation[] Board { get; private set; } + public Player NextToMove { get; private set; } + public GameResult Result { get; private set; } + + public GameState() + { + // Leeres Feld + Board = Enumerable.Repeat(Occupation.Free, 24).ToArray(); + NextToMove = Player.White; + Result = GameResult.Running; + } + + public bool IsValidMove() + + + } +} diff --git a/Morris/IGameStateObserver.cs b/Morris/IGameStateObserver.cs new file mode 100644 index 0000000..e90a47b --- /dev/null +++ b/Morris/IGameStateObserver.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Morris +{ + interface IGameStateObserver + { + } +} diff --git a/Morris/IMoveProvider.cs b/Morris/IMoveProvider.cs new file mode 100644 index 0000000..137ed56 --- /dev/null +++ b/Morris/IMoveProvider.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Morris +{ + interface IMoveProvider + { + } +} diff --git a/Morris/LICENSE b/Morris/LICENSE new file mode 100644 index 0000000..382b8ea --- /dev/null +++ b/Morris/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Markus Himmel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Morris/Morris.csproj b/Morris/Morris.csproj index 495c44d..20bded4 100644 --- a/Morris/Morris.csproj +++ b/Morris/Morris.csproj @@ -43,6 +43,16 @@ + + + + + + + + + + diff --git a/Morris/MoveResult.cs b/Morris/MoveResult.cs new file mode 100644 index 0000000..108094c --- /dev/null +++ b/Morris/MoveResult.cs @@ -0,0 +1,21 @@ +/* + * MoveResult.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Resultate eines Zuges, die für den relevant sind. + /// Insbesondere gibt MoveResult keine Information darüber, ob das Spiel durch + /// aktuellen Zug beendet wurde, da diese Informationen durch einen geeigneten + /// an den Benutzer weitergegeben werden soll. + /// + public enum MoveResult + { + GameNotRunning, + InvalidMove, + OK + } +} diff --git a/Morris/Occupation.cs b/Morris/Occupation.cs new file mode 100644 index 0000000..554451e --- /dev/null +++ b/Morris/Occupation.cs @@ -0,0 +1,18 @@ +/* + * Occupation.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Zustand, den eine Stelle auf dem Spielfeld einnehmen kann + /// + public enum Occupation + { + Free, + White, + Black + } +} \ No newline at end of file diff --git a/Morris/Phase.cs b/Morris/Phase.cs new file mode 100644 index 0000000..29a781c --- /dev/null +++ b/Morris/Phase.cs @@ -0,0 +1,18 @@ +/* + * Phase.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Eine Phase, in der sich ein Spieler während des Mühlespiels befinden kann + /// + public enum Phase + { + Placing, + Moving, + Flying + } +} diff --git a/Morris/Player.cs b/Morris/Player.cs new file mode 100644 index 0000000..c7647f5 --- /dev/null +++ b/Morris/Player.cs @@ -0,0 +1,17 @@ +/* + * Player.cs + * Copyright (c) 2016 Markus Himmel + * This file is distributed under the terms of the MIT license + */ + +namespace Morris +{ + /// + /// Repräsentiert einen Spieler + /// + public enum Player + { + White, + Black + } +}