-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config and in-game-world objects refactored
- Loading branch information
Showing
7 changed files
with
116 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,12 @@ | ||
from myenum import MyEnum | ||
from ecosystem import Species | ||
|
||
|
||
class Resources(MyEnum): | ||
|
||
values = ["raw_stone", "stone", "lumber"] | ||
|
||
|
||
class Buildings(MyEnum): | ||
|
||
values = ["quarry", "sawmill"] | ||
import config | ||
|
||
|
||
class Economy(object): | ||
|
||
def __init__(self): | ||
self._resources = { | ||
Resources.raw_stone: 500000, | ||
} | ||
self._buildings = { | ||
Buildings.quarry: 2, | ||
} | ||
self._iomatrix = { | ||
(Buildings.quarry, Resources.raw_stone): -100, | ||
(Buildings.quarry, Resources.stone): 50, | ||
(Buildings.sawmill, Species.ebony): -100, | ||
(Buildings.sawmill, Resources.lumber): 50, | ||
} | ||
def __init__(self, class_): | ||
self._class = class_ | ||
self._resources = config.INITIAL_RESOURCES[self._class] | ||
self._buildings = config.INITIAL_BUILDINGS[self._class] | ||
|
||
def sim(self): | ||
pass | ||
|
||
|
||
class EconomyClassB(Economy): | ||
|
||
def __init__(self): | ||
super(EconomyClassB, self).__init__() | ||
self._resources[Resources.raw_stone] *= 2 |
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
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,7 @@ | ||
""" | ||
Utility functions | ||
""" | ||
|
||
def multi_config(common_value, enum_): | ||
"""Used in config to copy common values for all planet classes""" | ||
return {key: common_value.copy() for key in enum_.get_all_values()} |