-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from wingedsheep/feature/2_add_farmers
Feature/2 add farmers
- Loading branch information
Showing
41 changed files
with
1,891 additions
and
470 deletions.
There are no files selected for viewing
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
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
Empty file.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from main.objects.coordinate import Coordinate | ||
from main.objects.farmer_side import FarmerSide | ||
from main.objects.side import Side | ||
|
||
|
||
class CoordinateWithFarmerSide: | ||
|
||
def __init__(self, coordinate: Coordinate, farmer_side: FarmerSide): | ||
self.coordinate = coordinate | ||
self.farmer_side = farmer_side | ||
|
||
def __eq__(self, other): | ||
return self.coordinate == other.coordinate and self.farmer_side == other.farmer_side | ||
|
||
def __hash__(self): | ||
return hash((self.coordinate, self.farmer_side)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from main.objects.farmer_connection_with_coordinate import FarmerConnectionWithCoordinate | ||
|
||
|
||
class Farm: | ||
def __init__(self, farmer_connections_with_coordinate: [FarmerConnectionWithCoordinate]): | ||
self.farmer_connections_with_coordinate: [FarmerConnectionWithCoordinate] = farmer_connections_with_coordinate |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import json | ||
|
||
from main.objects.farmer_side import FarmerSide | ||
from main.objects.side import Side | ||
|
||
|
||
class FarmerConnection: | ||
def __init__(self, farmer_positions: [Side], tile_connections: [FarmerSide] = (), city_sides: [Side] = ()): | ||
self.farmer_positions: [Side] = farmer_positions | ||
self.tile_connections: [FarmerSide] = tile_connections | ||
self.city_sides: [Side] = city_sides | ||
|
||
def to_json(self): | ||
return { | ||
"farmer_position": self.farmer_positions.to_json(), | ||
"tile_connections": self.tile_connections.to_json(), | ||
"city_sides": self.city_sides.to_json() | ||
} | ||
|
||
def __str__(self): | ||
return json.dumps(self.to_json(), indent=2) | ||
|
||
def __eq__(self, other): | ||
return self.farmer_positions == other.farmer_positions \ | ||
and self.tile_connections == other.tile_connections \ | ||
and self.city_sides == other.city_sides | ||
|
||
def __hash__(self): | ||
return hash((tuple(self.farmer_positions), tuple(self.tile_connections), tuple(self.city_sides))) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import json | ||
|
||
from main.objects.coordinate import Coordinate | ||
from main.objects.farmer_connection import FarmerConnection | ||
from main.objects.farmer_side import FarmerSide | ||
from main.objects.side import Side | ||
|
||
|
||
class FarmerConnectionWithCoordinate: | ||
def __init__(self, farmer_connection: FarmerConnection, coordinate: Coordinate = ()): | ||
self.farmer_connection: FarmerConnection = farmer_connection | ||
self.coordinate: Coordinate = coordinate | ||
|
||
def __eq__(self, other): | ||
return self.farmer_connection == other.farmer_connection \ | ||
and self.coordinate == other.coordinate | ||
|
||
def __hash__(self): | ||
return hash((self.farmer_connection, self.coordinate)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from enum import Enum | ||
|
||
from main.objects.side import Side | ||
|
||
|
||
class FarmerSide(Enum): | ||
TLL = "tll" | ||
TLT = "tlt" | ||
TRT = "trt" | ||
TRR = "trr" | ||
BLL = "bll" | ||
BLB = "blb" | ||
BRB = "brb" | ||
BRR = "brr" | ||
|
||
def to_json(self): | ||
return self.value | ||
|
||
def __str__(self): | ||
return self.value | ||
|
||
def get_side(self) -> Side: | ||
if self.value[2] == "l": | ||
return Side.LEFT | ||
if self.value[2] == "r": | ||
return Side.RIGHT | ||
if self.value[2] == "b": | ||
return Side.BOTTOM | ||
if self.value[2] == "t": | ||
return Side.TOP |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from enum import Enum | ||
|
||
|
||
class GamePhase(Enum): | ||
TILES = "tiles" | ||
MEEPLES = "meeples" | ||
|
||
def to_json(self): | ||
return self.value | ||
|
||
def __str__(self): | ||
return self.value |
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
Oops, something went wrong.