1
Fork 0

fsharp(ygosim): chore: grouped the Board, Side and Player modules

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-06 11:51:27 +02:00 committed by prescientmoon
parent c6689fd6fa
commit 34751250ae
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
4 changed files with 38 additions and 36 deletions

View file

@ -1,8 +1,42 @@
module Board
open Player
module Side =
open Card
type Board =
{ players: Player * Player }
type Side =
{ field: Card option
monsters: Card list
spells: Card list
graveyard: Card list
deck: Card list }
let emptyBoard = { players = (initialPlayer 8000, initialPlayer 8000) }
let emptySide =
{ field = None
monsters = []
spells = []
graveyard = []
deck = [] }
module Player =
open Side
type Player =
{ lifePoints: int
side: Side }
let inflictDamage (player: Player) amount = { player with lifePoints = player.lifePoints - amount }
let initialPlayer lp =
{ lifePoints = lp
side = emptySide }
module Board =
open Player
type Board =
{ players: Player * Player }
let emptyBoard = { players = (initialPlayer 8000, initialPlayer 8000) }

View file

@ -1,13 +0,0 @@
module Player
open Side
type Player =
{ lifePoints: int
side: Side }
let inflictDamage (player: Player) amount = { player with lifePoints = player.lifePoints - amount }
let initialPlayer lp =
{ lifePoints = lp
side = emptySide }

View file

@ -1,17 +0,0 @@
module Side
open Card
type Side =
{ field: Card option
monsters: Card list
spells: Card list
graveyard: Card list
deck: Card list }
let emptySide =
{ field = None
monsters = []
spells = []
graveyard = []
deck = [] }

View file

@ -7,8 +7,6 @@
<ItemGroup>
<Compile Include="src/Card.fs" />
<Compile Include="src/Side.fs" />
<Compile Include="src/Player.fs" />
<Compile Include="src/Board.fs" />
<Compile Include="src/Program.fs" />
</ItemGroup>