Created
January 10, 2019 16:00
-
-
Save jalvarado91/4417b379dff58884a97b68688e6ed2a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Player = "Boot" | "Battleship" | "Iron"; | |
type Color = "Brown" | "Magenta" | "LightBlue"; | |
type Houses = { count: number }; | |
type Development = "Empty" | Houses | "Hotel"; | |
// type TileTypes = "Street" | "Utility" | "Tax" | "Station"; | |
type Tile = { | |
// type: TileTypes; | |
name: string; | |
cost: number; | |
}; | |
type OwnableTile = Tile & { owner?: Player }; | |
type Street = OwnableTile & { | |
type: "Street"; | |
color: Color; | |
development: Development; | |
rentals: number[]; | |
}; | |
type Utility = OwnableTile & { type: "Utility" }; | |
type Station = OwnableTile & { type: "Station" }; | |
type Tax = Tile & { type: "Tax"; amount: number }; | |
// type Street = { | |
// tag: "Street"; | |
// name: string; | |
// cost: number; | |
// color: Color; | |
// development: Development; | |
// rentals: number[]; | |
// owner?: Player; | |
// }; | |
// type Utility = { | |
// tag: "Utility"; | |
// name: string; | |
// cost: number; | |
// owner?: Player; | |
// }; | |
// type Station = { | |
// tag: "Station"; | |
// name: string; | |
// cost: number; | |
// owner?: Player; | |
// }; | |
// type Tax = { | |
// tag: "Tax"; | |
// name: string; | |
// amount: number; | |
// owner?: Player; | |
// }; | |
type TileLocation = Street | Utility | Station | Tax; | |
type Board = TileLocation[]; | |
const ownsLocation = (player: Player, location: Tile): boolean => { | |
return false; | |
}; | |
const streetsOfColor = (color: Color, board: Board) => { | |
return board | |
.filter((tile): tile is Street => tile.type === "Street") | |
.map(tile => tile.color === color); | |
}; | |
const ownsStreetSet = (player: Player, color: Color, board: Board): boolean => { | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment