Each player has 5 robots. People move the robots alternately, if the robots meet in one field, one takes part of the energy of the other (or all). When the robot's power runs out, a second robot automatically appears.
or implement a fully random battle
from typing import List, Tuple
class Robot:
def __init__(self, name: str, place : List[int], start: Tuple[int, int] = (0,0), power: int = 9):
self._name = name
self._place = place
self._start = start
self._power = power
# further assignments
@property
def name(self):
return self._name
@name.setter
def name(self, value):
if isinstance(value, str):
self._name = value
else:
raise TypeError("must be a string")
@property
def place(self):
return self._place
@place.setter
def place(self, value):
if isinstance(value, list):
self._start = value
else:
raise TypeErorr("must be a list")
@property
def start(self):
return self._start
@start.setter
def start(self, value):
if isinstance(value, tuple):
self._start = value
else:
raise TypeErorr("must be a tuple")
@property
def power(self):
return self._power
@power.setter
def power(self, value):
if isinstance(value, int):
self._start = value
else:
raise TypeErorr("must be a int")
@property
def check_power(self):
if self._power <= 0:
raise ValueError("No power")
def up(self, value):
#def left(self, value):
#def right(self, value):
#def down(self, value):
def __str__(self):
return "{} {} {}".format(self._name, self._place, self._power)
That's what I have so far........... And im stucked. Im just starting with python pls help