From c6689fd6fab1acf0610517cd900db963e25062e5 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 5 Dec 2019 19:25:03 +0200 Subject: [PATCH] fsharp(ygosim): feat: added a way of creating a new board Signed-off-by: prescientmoon --- fsharp/ygosim/src/Board.fs | 4 +++- fsharp/ygosim/src/Card.fs | 1 + fsharp/ygosim/src/Player.fs | 12 +++--------- fsharp/ygosim/src/PlayerController.fs | 0 fsharp/ygosim/src/Side.fs | 9 ++++++++- 5 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 fsharp/ygosim/src/PlayerController.fs diff --git a/fsharp/ygosim/src/Board.fs b/fsharp/ygosim/src/Board.fs index b3ff3b8..64aa8f4 100644 --- a/fsharp/ygosim/src/Board.fs +++ b/fsharp/ygosim/src/Board.fs @@ -3,4 +3,6 @@ module Board open Player type Board = - { players: Player.Player * Player } + { players: Player * Player } + +let emptyBoard = { players = (initialPlayer 8000, initialPlayer 8000) } diff --git a/fsharp/ygosim/src/Card.fs b/fsharp/ygosim/src/Card.fs index 522dabb..037f53c 100644 --- a/fsharp/ygosim/src/Card.fs +++ b/fsharp/ygosim/src/Card.fs @@ -1,4 +1,5 @@ module Card +// TODO: actually implement it type Card = { name: string } diff --git a/fsharp/ygosim/src/Player.fs b/fsharp/ygosim/src/Player.fs index ce61076..7ed00f5 100644 --- a/fsharp/ygosim/src/Player.fs +++ b/fsharp/ygosim/src/Player.fs @@ -8,12 +8,6 @@ type Player = let inflictDamage (player: Player) amount = { player with lifePoints = player.lifePoints - amount } - -type PlayerControllerAction = - | ChooseZone - | BoardUpdate - -type PlayerActionPayload = PlayerControllerAction * Side - -type PlayerController = PlayerController of (PlayerControllerAction -> PlayerController) - \ No newline at end of file +let initialPlayer lp = + { lifePoints = lp + side = emptySide } diff --git a/fsharp/ygosim/src/PlayerController.fs b/fsharp/ygosim/src/PlayerController.fs deleted file mode 100644 index e69de29..0000000 diff --git a/fsharp/ygosim/src/Side.fs b/fsharp/ygosim/src/Side.fs index 57a2109..493852c 100644 --- a/fsharp/ygosim/src/Side.fs +++ b/fsharp/ygosim/src/Side.fs @@ -3,8 +3,15 @@ module Side open Card type Side = - { field: Card + { field: Card option monsters: Card list spells: Card list graveyard: Card list deck: Card list } + +let emptySide = + { field = None + monsters = [] + spells = [] + graveyard = [] + deck = [] }