Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Abstract army for abstract war solution in Speedy category for Army Units by GrigorySol
class Army:
def train_swordsman(self, name):
return Swordsman(self.swordsman, name, self.army_type)
def train_lancer(self, name):
return Lancer(self.lancer, name, self.army_type)
def train_archer(self, name):
return Archer(self.archer, name, self.army_type)
class Warrior:
def __init__(self, warrior_class, name, army_type):
self.army_type = army_type
self.name = name
self.warrior_class = warrior_class
def introduce(self):
return f"{self.warrior_class} {self.name}, {self.army_type} {self.warrior_type}"
class Swordsman(Warrior):
warrior_type = 'swordsman'
class Lancer(Warrior):
warrior_type = 'lancer'
class Archer(Warrior):
warrior_type = 'archer'
class AsianArmy(Army):
army_type = 'Asian'
swordsman, lancer, archer = 'Samurai', 'Ronin', 'Shinobi'
class EuropeanArmy(Army):
army_type = 'European'
swordsman, lancer, archer = 'Knight', 'Raubritter', 'Ranger'
Nov. 2, 2020