Code Duplication    Length = 23-23 lines in 3 locations

server/lib/ige/ospace/GalaxyGenerator.py 3 locations

@@ 166-188 (lines=23) @@
163
        self.diseases = {}
164
165
166
class Circle9P(GalaxyTemplate):
167
    def __init__(self):
168
        super(Circle9P, self).__init__()
169
170
        #self.galaxyDescription = "Smaller galaxy for 9 players, without pirate or EDEN. Recommended for new players or those who seek more casual gameplay."
171
        self.scenario = Const.SCENARIO_OUTERSPACE
172
        self.minPlanets = 500
173
        self.maxPlanets = 600
174
        self.startR = (15.0, 18.0)
175
        self.players = 9
176
        self.playerGroup = 3
177
        self.groupDist = 4
178
        self.minR = 5
179
        # format {minRadius: density, nextCircleRadius: differentDensity}
180
        self.density = {5: 4, 10: 4.5, 20: 4.5, 26: 5}
181
        self.resources = {
182
            # format resourceID : [(minDist, maxDist, number of resources)]
183
            Const.SR_TL1A : [(20, 25, 6)],
184
            Const.SR_TL1B : [(20, 25, 6)]
185
        }
186
        self.diseases = {
187
            # format diseaseID : (minDist, maxDist, number of diseases)
188
            Const.DISEASE_MUTANT : [(13, 20, 6), (5, 9, 6)]
189
        }
190
191
class Circle42P(GalaxyTemplate):
@@ 110-132 (lines=23) @@
107
        self.diseases = {}
108
109
110
class Circle3SP(GalaxyTemplate):
111
    def __init__(self):
112
        super(Circle3SP, self).__init__()
113
114
        #self.galaxyDescription = "More complex single player galaxy with classic starting group of three. Mutant is the only agressive enemy. Endless game."
115
        self.scenario = Const.SCENARIO_SINGLE
116
        self.minPlanets = 350
117
        self.maxPlanets = 400
118
        self.startR = (15.0, 17.0)
119
        self.players = 3
120
        self.playerGroup = 3
121
        self.groupDist = 3
122
        self.minR = 3
123
        # format {minRadius: density, nextCircleRadius: differentDensity}
124
        self.density = {3: 3.5, 5: 4.5, 10: 4.5, 20: 4.5, 25: 5}
125
        self.resources = {
126
            # format resourceID : [(minDist, maxDist, number of resources)]
127
            Const.SR_TL1A : [(15, 17, 3)],
128
            Const.SR_TL1B : [(15, 17, 3)]
129
        }
130
        self.diseases = {
131
            # format diseaseID : (minDist, maxDist, number of diseases)
132
            Const.DISEASE_MUTANT : [(2, 4, 3)]
133
        }
134
135
@@ 64-86 (lines=23) @@
61
        # making radius a bit bigger, as that is used in minimaps and chronicler
62
        return max(self.density.keys()) + 2
63
64
class Circle1SP(GalaxyTemplate):
65
    def __init__(self):
66
        super(Circle1SP, self).__init__()
67
68
        self.galaxyDescription = "Single player galaxy to enjoy freebuilding. Mutant is the only enemy. Endless game."
69
        self.scenario = Const.SCENARIO_SINGLE
70
        self.minPlanets = 100
71
        self.maxPlanets = 150
72
        self.startR = (9.0, 11.0)
73
        self.players = 1
74
        self.playerGroup = 1
75
        self.groupDist = 0
76
        self.minR = 2
77
        # format {minRadius: density, nextCircleRadius: differentDensity}
78
        self.density = {2: 4, 5: 4, 12: 4.5}
79
        self.resources = {
80
            # format resourceID : [(minDist, maxDist, number of resources)]
81
            Const.SR_TL1A : [(11, 13, 2)],
82
            Const.SR_TL1B : [(11, 13, 2)]
83
        }
84
        self.diseases = {
85
            # format diseaseID : (minDist, maxDist, number of diseases)
86
            Const.DISEASE_MUTANT : [(2, 5, 3)]
87
        }
88
89