Bacics help
Posted: Wed Nov 03, 2010 3:40 am
Hi,
I discovered Cobra yesterday and I like it a lot. I'm a python programmer.
To try something out I made this code.. I can not get it to work yet though. It would be great if somebody could help me with the bugs.
Also please comment on my code.
I discovered Cobra yesterday and I like it a lot. I'm a python programmer.
To try something out I made this code.. I can not get it to work yet though. It would be great if somebody could help me with the bugs.
Also please comment on my code.
class Controller
var colonys = List<of Colony>()
cue init(amount_colonys as int, amount_bacteria as int)
base.init
for i in amount_colonys
col as Colony = Colony()
.colonys.add(col)
for j in amount_bacteria
col.add_bacteria
class Colony
var bacteria = List<of Bacteria>()
def add_bacteria
bac as Bacteria = Bacteria()
.bacteria.add(bac)
def get_bacterias as List<of Bacteria>
return .bacteria
class Bacteria
var _twin as Bacteria? = nil
cue init(twin as Bacteria?)
base.init
#age = 0
if twin
_twin = twin
class Program
def main
controller as Controller = Controller(1, 1)
print controller.colonys