Skip to content

Commit

Permalink
Merge pull request #31 from Stephenson-Software/randomized-living-ent…
Browse files Browse the repository at this point in the history
…ity-distribution

Randomized Living Entity Distribution
  • Loading branch information
dmccoystephenson authored Aug 3, 2022
2 parents 9ff8609 + 6b2a5e1 commit a5c2460
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 17 additions & 11 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ class Config:

def __init__(self):
# local
grassFactor = random.randrange(2, 6)
livingEntityFactor = 1.5
minGridSize = 16
maxGridSize = 32
grassFactor = random.randrange(3, 10)
livingEntityFactor = 0.2
minGridSize = 8
maxGridSize = 36
minGrassGrowTime = 100
maxGrassGrowTime = 500
maxGrassGrowTime = 300
chickenFactor = random.randrange(1, 10)
pigFactor = random.randrange(0, 10)
cowFactor = random.randrange(0, 10)
wolfFactor = random.randrange(0, 5)
foxFactor = random.randrange(0, 5)
rabbitFactor = random.randrange(0, 10)

# static
self.displayWidth = 400
Expand All @@ -37,9 +43,9 @@ def __init__(self):
# calculated
self.textSize = ceil(self.displayHeight/37)
self.numGrassEntities = ceil(self.gridSize*self.gridSize*grassFactor)
self.numChickensToStart = ceil(self.gridSize*livingEntityFactor/1)
self.numPigsToStart = ceil(self.gridSize*livingEntityFactor/1)
self.numCowsToStart = ceil(self.gridSize*livingEntityFactor/2)
self.numWolvesToStart = ceil(self.gridSize*livingEntityFactor/8)
self.numFoxesToStart = ceil(self.gridSize*livingEntityFactor/4)
self.numRabbitsToStart = ceil(self.gridSize*livingEntityFactor/1)
self.numChickensToStart = ceil(self.gridSize*livingEntityFactor*chickenFactor)
self.numPigsToStart = ceil(self.gridSize*livingEntityFactor*pigFactor)
self.numCowsToStart = ceil(self.gridSize*livingEntityFactor*cowFactor)
self.numWolvesToStart = ceil(self.gridSize*livingEntityFactor*wolfFactor)
self.numFoxesToStart = ceil(self.gridSize*livingEntityFactor*foxFactor)
self.numRabbitsToStart = ceil(self.gridSize*livingEntityFactor*rabbitFactor)
2 changes: 1 addition & 1 deletion rabbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Rabbit(Entity):

def __init__(self, name):
Entity.__init__(self, name, random.randrange(20, 30), True, [Grass])
self.color = (250,235,215)
self.color = (250,220,200)

def getColor(self):
return self.color

0 comments on commit a5c2460

Please sign in to comment.