コード例 #1
0
class Soldier:
    def __init__(self):
        self.health = 100
        self.numElixirs = 2
        self.pos = Pos()
        self.keys = set()

    def getHealth(self):
        return self.health

    def loseHealth(self):
        self.health -= 10
        return self.health <= 0

    def recover(self, healingPower):
        totalHealth = healingPower + self.health
        self.health = 100 if totalHealth >= 100 else totalHealth

    def getPos(self):
        return self.pos

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def move(self, row, column):
        self.setPos(row, column)

    def getKeys(self):
        return self.keys

    def addKey(self, key):
        self.keys.add(key)

    def getNumElixirs(self):
        return self.numElixirs

    def addElixir(self):
        self.numElixirs += 1

    def useElixir(self):
        self.recover(random.randint(0, 5) + 15)
        self.numElixirs -= 1

    def displayInformation(self):
        print('Health: ', self.health, '.', sep='')
        print('Position (row, column): (',
              self.pos.getRow(),
              ', ',
              self.pos.getColumn(),
              ').',
              sep='')
        print('Keys: ', list(self.keys), '.', sep='')
        print('Elixirs: ', self.numElixirs, '.', sep='')

    def displaySymbol(self):
        print('S', end='')
コード例 #2
0
class Soldier():

  def __init__(self):
    self.health = 100
    self.numElixirs = 2
    self.pos = Pos()
    self.keys = set()

  def getHealth(self):
    return self.health

  def loseHealth(self):
    self.health -= 10
    return self.health <= 0

  def recover(self, healingPower):
    totalHealth = healingPower + self.health
    if totalHealth >= 100:
      self.health = 100
    else:
      self.health = totalHealth

  def getPos(self):
    return self.pos

  def setPos(self, row, column):
    self.pos.setPos(row, column)

  def move(self, row, column):
    self.setPos(row, column)

  def getKeys(self):
    return list(self.keys)

  def addKey(self, key):
    return self.keys.add(key)

  def getNumElixirs(self):
    return self.numElixirs

  def addElixir(self):
    self.numElixirs += 1

  def useElixir(self):
    self.recover(random.randint(15, 20))
    self.numElixirs -= 1

  def displayInformation(self):
    print("Health: {}.".format(self.health))
    print("Position (row, column): ({}, {}).".format(self.pos.getRow(), self.pos.getColumn()))
    print("Keys: " + str(list(self.keys)))
    print("Elixirs: {}.".format(self.numElixirs))

  def displaySymbol(self):
    print("S",end="")
コード例 #3
0
class Obstacle(object):
    def __init__(self, posx, posy, index, game):
        self.pos = Pos(posx, posy)
        self.index = index
        self.game = game

    def getPos(self):
        return self.pos

    def teleport(self):
        randx = random.randint(0, (self.game.D - 1))
        randy = self.game.D - randx - 1
        while (self.game.positionOccupied(randx, randy)):
            randx = random.randint(0, (self.game.D - 1))
            randy = self.game.D - randx - 1
        self.pos.setPos(randx, randy)
コード例 #4
0
ファイル: Task4Merchant.py プロジェクト: jzzhang8/ppl
class Task4Merchant():
    def __init__(self):
        self.pos = Pos()
        self.elixirPrice = 1
        self.shieldPrice = 2

    def actionOnSoldier(self, soldier):
        self.talk(
            "Do you want to buy something? (1. Elixir, 2. Shield, 3. Leave.) Input: "
        )

        choice = input()

        if choice == "1":
            if soldier.getCoins() >= self.elixirPrice:
                soldier.addElixir()
                soldier.useCoins(self.elixirPrice)
            else:
                self.talk("You don't have enough coins.\n\n")

        elif choice == "2":
            if soldier.getCoins() >= self.shieldPrice:
                soldier.addShield()
                soldier.useCoins(self.shieldPrice)
            else:
                self.talk("You don't have enough coins.\n\n")

        elif choice == "3":
            pass  # leave directly

        else:
            print("=> Illegal choice!\n")

    def talk(self, text):
        print("Merchant$: " + text, end="")

    def getPos(self):
        return self.pos

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def displaySymbol(self):
        print("$", end="")
class Task4Merchant():
    def __init__(self):
        self.elixirPrice = 0
        self.shieldPrice = 0
        self.pos = Pos()

    def actionOnSoldier(self, soldier):

        choice = input(
            'Merchant$: Do you want to buy something? (1. Elixir, 2. Shield, 3. Leave.) Input: '
        )  # input choice

        if choice == '1':  # if choice = 1
            if soldier.task4GetCoins() >= 1:  # check enough coin
                soldier.task4BuyElixirs()
            else:
                self.talk("You don't have enough coins.\n\n")

        elif choice == '2':
            if soldier.task4GetCoins() >= 2:  # check enough coins
                soldier.task4BuyDefence()
            else:
                self.talk("You don't have enough coins.\n\n")
        elif choice != '3':
            print("=> Illegal choice!\n")  # illegal choice

    def talk(self, text):
        print("Merchant$: ", text, sep='', end='')

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def displaySymbol(self):
        print('$', end='')

    def getPos(self):
        return self.pos
コード例 #6
0
class Spring:
    def __init__(self):
        self.numChance = 1
        self.healingPower = 100
        self.pos = Pos()

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def getPos(self):
        return self.pos

    def actionOnSoldier(self, soldier):
        self.talk()
        if self.numChance == 1:
            soldier.recover(self.healingPower)
            self.numChance -= 1

    def talk(self):
        print('Spring@: You have', self.numChance,
              'chance to recover 100 health.\n')

    def displaySymbol(self):
        print('@', end='')
コード例 #7
0
class Spring():

  def __init__(self):
    self.numChance = 1
    self.healingPower = 100
    self.pos = Pos()

  def setPos(self, row, column):
    self.pos.setPos(row, column)

  def getPos(self):
    return self.pos

  def actionOnSoldier(self, soldier):
    self.talk()
    if self.numChance == 1:
      soldier.recover(self.healingPower)
      self.numChance -= 1

  def talk(self):
    print("Spring@: You have {} chance to recover 100 health.\n".format(self.numChance))

  def displaySymbol(self):
    print("@",end="")
コード例 #8
0
ファイル: Monster.py プロジェクト: jzzhang8/ppl
class Monster():
    def __init__(self, monsterID, healthCapacity):
        self.monsterID = monsterID
        self.healthCapacity = healthCapacity
        self.health = healthCapacity
        self.pos = Pos()
        self.dropItemList = []
        self.hintList = []

    def addDropItem(self, key):
        self.dropItemList.append(key)

    def addHint(self, monsterID):
        self.hintList.append(monsterID)

    def getMonsterID(self):
        return self.monsterID

    def getPos(self):
        return self.pos

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def getHealthCapacity(self):
        return self.healthCapacity

    def getHealth(self):
        return self.health

    def loseHealth(self):
        self.health -= 10
        return self.health <= 0

    def recover(self, healingPower):
        self.health = healingPower

    def actionOnSoldier(self, soldier):
        if self.health <= 0:
            self.talk("You had defeated me.\n\n")
        else:
            if self.requireKey(soldier.getKeys()):
                self.fight(soldier)
            else:
                self.displayHints()

    def requireKey(self, keys):
        return (self.monsterID in keys)

    def displayHints(self):
        self.talk("Defeat Monster " + str(self.hintList) + " first.\n\n")

    def fight(self, soldier):
        fightEnabled = True

        while fightEnabled:
            print("       | Monster{} | Soldier |".format(self.monsterID))
            print("Health | {:>8d} | {:>7d} |\n".format(
                self.health, soldier.getHealth()))
            print(
                "=> What is the next step? (1 = Attack, 2 = Escape, 3 = Use Elixir.) Input: ",
                end="")

            choice = input()

            if choice == "1":
                if self.loseHealth():
                    print("=> You defeated Monster{}.\n".format(
                        self.monsterID))
                    self.dropItems(soldier)
                    fightEnabled = False
                else:
                    if soldier.loseHealth():
                        self.recover(self.healthCapacity)
                        fightEnabled = False
            elif choice == "2":
                self.recover(self.healthCapacity)
                fightEnabled = False
            elif choice == "3":
                if soldier.getNumElixirs() == 0:
                    print("=> You have run out of elixirs.\n")
                else:
                    soldier.useElixir()
            else:
                print("=> Illegal choice!\n")

    def dropItems(self, soldier):
        for item in self.dropItemList:
            soldier.addKey(item)

    def talk(self, text):
        print("Monster{}: ".format(self.monsterID) + text, end="")

    def displaySymbol(self):
        print("M", end="")
コード例 #9
0
class Player(object):
    def __init__(self, healthCap, mob, posx, posy, index, game):
        self.MOBILITY = mob
        self.healthCap = healthCap
        self.health = self.healthCap
        self.pos = Pos(posx, posy)
        self.equipment = 0
        self.index = index
        self.myString = ""
        self.game = game

    def getPos(self):
        return self.pos

    def teleport(self):
        randx = random.randint(0, (self.game.D - 1))
        randy = random.randint(0, (self.game.D - 1))
        while (self.game.positionOccupied(randx, randy)):
            randx = random.randint(0, (self.game.D - 1))
            randy = random.randint(0, (self.game.D - 1))
        self.pos.setPos(randx, randy)

    def increaseHealth(self, h):
        if ((self.health + h) > self.healthCap):
            self.health = self.healthCap
        else:
            self.health += h

    def decreaseHealth(self, h):
        self.health -= h
        if (self.health <= 0):
            self.health = 0
            self.myString = "C" + self.myString[0]

    def getName(self):
        return self.myString

    def askForMove(self):
        string = "Your health is " + str(
            self.health) + ". Your position is (" + str(
                self.pos.getX()) + "," + str(
                    self.pos.getY()) + "). Your mobility is " + str(
                        self.MOBILITY) + "."
        print string
        print "You now have following options: "
        print "1. Move"
        print "2. Attack"
        print "3. End the turn"
        a = input()

        if (a == 1):
            print "Specify your target position (Input 'x y')."
            x, y = raw_input().split()
            posx = int(x)
            posy = int(y)
            if (self.pos.distance(posx, posy) > self.MOBILITY):
                print "Beyond your reach. Staying still."
            elif (self.game.positionOccupied(posx, posy)):
                print "Position occupied. Cannot move there."
            else:
                self.pos.setPos(posx, posy)
                self.game.printBoard()
                print "You can now \n1.attack\n2.End the turn"
                choice = input()
                if (choice == 1):
                    print "Input position to attack. (Input 'x y')"
                    ax, ay = raw_input().split()
                    attx = int(ax)
                    atty = int(ay)
                    self.equipment.action(attx, atty)
        elif (a == 2):
            print "Input position to attack."
            ax, ay = raw_input().split()
            attx = int(ax)
            atty = int(ay)
            self.equipment.action(attx, atty)
        elif (a == 3):
            return

    def askForMoveHeal(self):
        string = "Your health is " + str(
            self.health) + ". Your position is (" + str(
                self.pos.getX()) + "," + str(
                    self.pos.getY()) + "). Your mobility is " + str(
                        self.MOBILITY) + "."
        print string
        print "You now have following options: "
        print "1. Move"
        print "2. Heal"
        print "3. End the turn"
        a = input()

        if (a == 1):
            print "Specify your target position (Input 'x y')."
            x, y = raw_input().split()
            posx = int(x)
            posy = int(y)
            if (self.pos.distance(posx, posy) > self.MOBILITY):
                print "Beyond your reach. Staying still."
            elif (self.game.positionOccupied(posx, posy)):
                print "Position occupied. Cannot move there."
            else:
                self.pos.setPos(posx, posy)
                self.game.printBoard()
                print "You can now \n1.heal\n2.End the turn"
                choice = input()
                if (choice == 1):
                    print "Input position to heal. (Input 'x y')"
                    hx, hy = raw_input().split()
                    healx = int(hx)
                    healy = int(hy)
                    self.equipment.action(healx, healy)
        elif (a == 2):
            print "Input position to heal."
            hx, hy = raw_input().split()
            healx = int(hx)
            healy = int(hy)
            self.equipment.action(healx, healy)
        elif (a == 3):
            return
コード例 #10
0
class Warrior:
    _HEALTH_CAP = 40
    _pos = None
    _index = None
    _health = None
    _name = None
    _map = None
    _magic_crystal = None

    def __init__(self, posx, posy, index, map):
        self._pos = Pos(posx, posy)
        self._index = index
        self._map = map
        self._name = 'W' + str(index)
        self._health = self._HEALTH_CAP
        self._magic_crystal = 10

    def teleport(self):
        print('Hi, ' + self._name + '. ' +
              'Your position is (%d,%d) and health is %d.' %
              (self._pos.x, self._pos.y, self._health))
        print('Specify your target position (Input \'x y\').')
        userinput = input()
        posx, posy = userinput.split()
        posy = int(posy)
        posx = int(posx)
        while (posx == self._pos.x) and (posy == self._pos.y):
            print(
                'Specify your target position (Input \'x y\'). It should not be the same as the original one.'
            )
            userinput = input()
            posx, posy = userinput.split()
            posx = int(posx)
            posy = int(posy)
            pass
        result = self._map.coming(posx, posy, self)
        if result:
            self._map.setLand(self._pos, None)
            self._pos.setPos(posx, posy)
            self._map.setLand(self._pos, self)
        if self._health <= 0:
            print('Very sorry, ' + self._name + ' has been killed.')
            self._map.setLand(self._pos, None)
            self._map.deleteTeleportableObj(self)
            self._map.decreaseNumOfWarriors()
        pass

    def talk(self, content):
        print(self._name + ': ' + content)
        pass

    def increaseCrystal(self, value):
        self._magic_crystal += value
        pass

    def decreaseCrystal(self, value):
        self._magic_crystal -= value
        pass

    def increaseHealth(self, value):
        self._health += value
        if self._health > self._HEALTH_CAP:
            self._health = self._HEALTH_CAP
        pass

    def decreaseHealth(self, value):
        self._health -= value
        pass

    @property
    def pos(self):
        return self._pos

    @property
    def name(self):
        return self._name

    @property
    def health(self):
        return self._health

    @health.setter
    def health(self, _health):
        self._health = _health
        pass

    @property
    def magic_crystal(self):
        return self._magic_crystal
        pass

    @magic_crystal.setter
    def magic_crystal(self, _magic_crystal):
        self._magic_crystal = _magic_crystal
        pass
コード例 #11
0
class Unit(metaclass=ABCMeta):
        
    # 1: blue (초), 2: red (한)
    iFlag = 0;

    # Unit Name
    strName = '';
    
    # Unit Pos
    mPos = None;
    
    # Unit Score
    iScore = 0;
    
    # Game Stage
    game = None
    

    def __init__(self, flag, Game):
        self.mPos = Pos(0, 0)
        self.iFlag = flag
        # 개별 유닛들이 게임 스테이지를 참조할 수 있게 한다
        self.game = Game;
    
    def setScore(self, score):
        self.iScore = score;
        
    def getScore(self):
        return self.iScore;
            
    def getFlag(self):    
        return self.iFlag
    
    def setFlag(self, flag):
        self.iFlag = flag;

    def setPos(self, x, y):
        self.mPos.setPos(x, y);
        
    def getPos(self):
        return self.mPos;
    
    def getX(self):
        return self.mPos.getXPos()
    def getY(self):
        return self.mPos.getYPos()
    
    def setName(self, name):
        self.strName = name;
        
    def getName(self):
        self.strName;
        
    def __str__(self):
        flag = "";
        if self.iFlag == 1:
            flag = "B_";
        if self.iFlag == 2:
            flag = "R_";
        
        return "%6s" % (flag + self.strName);
    
    def __repr__(self):
        return self.__str__();
    
    @abstractclassmethod
    def getPossibleMoveList(self):
        '''
コード例 #12
0
class Warrior:
    _HEALTH_CAP = 40
    _pos = None
    _index = None
    _health = None
    _name = None
    _map = None
    _magic_crystal = None

    def __init__(self, posx, posy, index, map):
        self._pos = Pos(posx, posy)
        self._index = index
        self._map = map
        self._name = 'W' + str(index)
        self._health = self._HEALTH_CAP
        self._magic_crystal = 10

    def teleport(self):
        print('Hi, ' + self._name + '. ' + 'Your position is (%d,%d) and health is %d.' % (self._pos.x, self._pos.y, self._health))
        print('Specify your target position (Input \'x y\').')
        userinput = input()
        posx, posy = userinput.split()
        posy = int(posy)
        posx = int(posx)
        while (posx == self._pos.x) and (posy == self._pos.y):
            print('Specify your target position (Input \'x y\'). It should not be the same as the original one.')
            userinput = input()
            posx, posy = userinput.split()
            posx = int(posx)
            posy = int(posy)
            pass
        result = self._map.coming(posx, posy, self)
        if result :
            self._map.setLand(self._pos, None)
            self._pos.setPos(posx, posy)
            self._map.setLand(self._pos, self)
        if self._health <= 0:
            print('Very sorry, '+self._name+' has been killed.')
            self._map.setLand(self._pos, None)
            self._map.deleteTeleportableObj(self)
            self._map.decreaseNumOfWarriors()
        pass

    def talk(self, content):
        print(self._name+': '+content)
        pass

    def increaseCrystal(self, value):
        self._magic_crystal += value;
        pass

    def decreaseCrystal(self, value):
        self._magic_crystal -= value;
        pass

    def increaseHealth(self, value):
        self._health += value;
        if self._health > self._HEALTH_CAP:
            self._health = self._HEALTH_CAP
        pass

    def decreaseHealth(self, value):
        self._health -= value;
        pass

    @property
    def pos(self):
        return self._pos

    @property
    def name(self):
        return self._name

    @property
    def health(self):
        return self._health

    @health.setter
    def health(self, _health):
        self._health = _health
        pass

    @property
    def magic_crystal(self):
        return self._magic_crystal
        pass

    @magic_crystal.setter
    def magic_crystal(self, _magic_crystal):
        self._magic_crystal = _magic_crystal
        pass

    def actionOnWarrior(self,warrior):
        self.talk('Hi, bro. You can call me '+ self.name + '.  I am very happy to meet you.  ' + 'I have %d magic crystals.' % self.magic_crystal)
        self.talk('The number of your magic crystals is ' + str(warrior.magic_crystal)+'.')
        self.talk('Need I share with you some magic crystals?')
        self.talk('You now have following options: ')
        print('1. Yes');
        print('2. No');
        a = input()
        a = int(a)
        if a == 1 :
            value = random.randint(0, self.magic_crystal-2)+2
            if self.magic_crystal > value :
                self.decreaseCrystal(value)
                warrior.increaseCrystal(value)
                warrior.talk('Thanks for your shared %d magic crystals !' % value + self.name + '.')
            else :
                self.talk('Very embarrassing, I don\'t have enough crystals.')
                warrior.talk('That is fine, '+ self.name + ' ! After all we are all poor sons.')
        return False
        pass
コード例 #13
0
class Player(object):
    __metaclass__ = abc.ABCMeta

    def __init__(self, healthCap, mob, posx, posy, index, game):
        self.__MOBILITY = mob
        self._health = healthCap
        self._pos = Pos(posx, posy)
        self._index = index
        self._game = game
        self._myString = ""
        self._equipment = ""

    def getPos(self):
        return self._pos

    def teleport(self):
        randx = random.randint(0, self._game.D - 1)
        randy = random.randint(0, self._game.D - 1)
        while (self._game.positionOccupied(randx, randy)):
            randx = random.randint(0, self._game.D - 1)
            randy = random.randint(0, self._game.D - 1)
        self._pos.setPos(randx, randy)

    def increaseHealth(self, h):
        self._health = h + self._health

    def decreaseHealth(self, h):
        self._health = self._health - h
        if (self._health <= 0):
            self._myString = "C" + self._myString[0]

    def getName(self):
        return self._myString

    def askForMove(self):
        print "Your health is ",
        print self._health,
        print ". Your position is ({0},{1}). Your mobility is {2}.".format(
            self._pos.getX(), self._pos.getY(), self.__MOBILITY)
        print "You now have following options: "
        print "1. Move"
        print "2. Attack"
        print "3. End the turn"

        a = int(raw_input())

        if (a == 1):
            print "Specify your target position (Input 'x y')."
            posx = int(raw_input())
            posy = int(raw_input())
            if (self._pos.distance(posx, posy) > self.__MOBILITY):
                print "Beyond your reach. Staying still."
            elif self._game.positionOccupied(posx, posy):
                print "Position occupied. Cannot move there."
            else:
                self._pos.setPos(posx, posy)
                self._game.printBoard()
                print "You can now "
                print "1.attack"
                print "2.End the turn"
                if (int(raw_input()) == 1):
                    print "Input position to attack. (Input 'x y')"
                    attx = int(raw_input())
                    atty = int(raw_input())
                    self._equipment.action(attx, atty)
        elif (a == 2):
            print "Input position to attack."
            attx = int(raw_input())
            atty = int(raw_input())
            self._equipment.action(attx, atty)
        elif (a == 3):
            return
コード例 #14
0
class Monster:
    def __init__(self, monsterID, healthCapacity):
        self.monsterID = monsterID
        self.healthCapacity = healthCapacity
        self.health = healthCapacity
        self.pos = Pos()
        self.dropItemList = set()  ###
        self.hintList = set()  ###

    def addDropItem(self, key):
        self.dropItemList.add(key)

    def addHint(self, monsterID):
        self.hintList.add(monsterID)

    def getMonsterId(self):
        return self.monsterID

    def getPos(self):
        return self.pos

    def setPos(self, row, column):
        self.pos.setPos(row, column)

    def getHealthCapacity(self):
        return self.healthCapacity

    def getHealth(self):
        return self.health

    def loseHealth(self):
        self.health -= 10
        return self.health <= 0

    def recover(self, healingPower):
        self.health = healingPower

    def actionOnSoldier(self, soldier):
        if self.health <= 0:
            self.talk('You had defeated me.\n')
        else:
            if self.requireKey(soldier.getKeys()):
                self.fight(soldier)
            else:
                self.displayHints()

    def requireKey(self, keys):
        return self.monsterID in keys

    def displayHints(self):
        str1 = '['
        for x in self.hintList:
            str1 += str(x) + ', '

        str1 = str1[:-2]
        str1 += '] '

        self.talk('Defeat Monster ' + str1 + 'first.\n')

    def fight(self, soldier):
        fightEnabled = True

        while fightEnabled:
            print('       | Monster', self.monsterID, ' | Soldier |', sep='')
            print('Health | ',
                  '%8d' % self.health,
                  ' | ',
                  '%7d' % soldier.getHealth(),
                  ' |\n',
                  sep='')

            choice = input(
                '=> What is the next step? (1 = Attack, 2 = Escape, 3 = Use Elixir.) Input: '
            )

            if choice == '1':
                if self.loseHealth():
                    print('=> You defeated Monster',
                          self.monsterID,
                          '.\n',
                          sep='')
                    self.dropItems(soldier)
                    fightEnabled = False
                else:
                    if soldier.loseHealth():
                        self.recover(self.healthCapacity)
                        fightEnabled = False
            elif choice == '2':
                self.recover(self.healthCapacity)
                fightEnabled = False
            elif choice == '3':
                if soldier.getNumElixirs() == 0:
                    print('=> You have run out of elixirs.\n')
                else:
                    soldier.useElixir()
            else:
                print('=> Illegal choice!\n')

    def dropItems(self, soldier):
        for item in self.dropItemList:
            soldier.addKey(item)

    def talk(self, text):
        print('Monster', self.monsterID, ': ', text, '\n', end='', sep='')

    def displaySymbol(self):
        print("M", end='')
コード例 #15
0
ファイル: Player.py プロジェクト: jaslioin/3180pvp
class Player(object):
    def __init__(self, healthCap, mob, posx, posy, index, game):
        self.MOBILITY = mob
        self.health = healthCap
        self.pos = Pos(posx, posy)
        self.index = index
        self.game = game

    def getPos(self):
        return self.pos

    def teleport(self):

        randx = random.randint(0, self.game.D - 1)

        randy = random.randint(0, self.game.D - 1)
        #print "Player teleported to ",randx," ",randy
        while self.game.positionOccupied(randx, randy):
            randx = random.randint(0, self.game.D - 1)
            randy = random.randint(0, self.game.D - 1)
        self.pos.setPos(randx, randy)

    def increaseHealth(self, h):
        self.health += h

    def decreaseHealth(self, h):
        self.health -= h
        if self.health <= 0:
            self.myString = "C" + self.myString[0]

    def getName(self):
        return self.myString

    def askForMove(self):
        print(
            "Your health is %d Your position is (%d,%d). Your mobility is %d."
            % (self.health, self.pos.getX(), self.pos.getY(), self.MOBILITY))
        print("You now have following options: ")
        print("1. Move")
        print("2. Attack")
        print("3. End tne turn")

        a = int(raw_input())

        if a == 1:
            print "Specify your target position (Input 'x y')."
            posx, posy = map(int, raw_input().split())
            if self.pos.distance(posx, posy) > self.MOBILITY:
                print "Beyond your reach. Staying still."
            elif self.game.positionOccupied(posx, posy):
                print "Position occupied. Cannot move there."
            else:
                self.pos.setPos(posx, posy)
                self.game.printBoard()
                print "You can now \n1.attack\n2.End the turn"
                if int(raw_input()) == 1:
                    print "Input position to attack. (Input 'x y')"
                    attx, atty = map(int, raw_input().split())
                    self.equipment.action(attx, atty)
        elif a == 2:
            print "Input position to attack."
            attx, atty = map(int, raw_input().split())
            self.equipment.action(attx, atty)
        elif a == 3:
            return