Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/World.py
blob: 9f8dd50e8ca30a7100e22660c885270e7d824084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
### By Gonzalo Odiard, 2006 godiard at gmail.com
### GPL License - http://www.gnu.org/copyleft/gpl.html

# inicializacion
MARGEN = 0
SIZE_WORLD = 800			 # 700
CANT_TILES =  25 			 #  30
print "*** calculo SIZE "
SIZE_TILE = int((SIZE_WORLD - MARGEN * 2) / CANT_TILES)
print "Size tile:", SIZE_TILE

EVENT_DEATH = 10

class RabbitData:
    edadMaxima = 100
    madurezSexual = 20
    frecuenciaSexual = 10
    nivelCadenaAlimenticia = 1
    minFrecuenciaAlimentacion = 10
    maxFrecuenciaAlimentacion = 1
    maxNumeroCrias = 5
        
class WorldEvent:
    def __init__ (self,x,y,event):
        self.x = x
        self.y = y
        self.event = event;
        
		
class FoxData:
    edadMaxima = 150
    madurezSexual = 20
    frecuenciaSexual = 10
    nivelCadenaAlimenticia = 2
    minFrecuenciaAlimentacion = 20
    maxFrecuenciaAlimentacion = 3
    maxNumeroCrias = 3

class World:
    initialGreen = 10
    initialRabbits = 10
    initialFoxs = 10
    playState = False
    state = []
    events = []
    animals = []
    rain_value = 1
    
    rabbit_data = RabbitData()
    fox_data = FoxData()

	
    def animalsNear(self,x,y):
        animalsNear = []
        for n in range(len(self.animals)):
            animal = self.animals[n]
            if ((abs(animal.posX-x) == 1) and 
                (abs(animal.posY-y) == 1)):
                animalsNear.append(animal) 
                #print "Encuentra",x,y,animal.posX,animal.posY
        return animalsNear