"""wargame.hut

This module contains the Hut class implementation.

This module is compatible with Python 3.5.x. It contains
supporting code for the book, Learning Python Application Development,
Packt Publishing.

.. todo::

   The code comments and function descriptions in this file are
   intentionally kept to a minimum! See Chapter 4 of the book to
   learn about the code documentation and best practices!

:copyright: 2016, <NAME>

:license: The MIT License (MIT) . See LICENSE file for further details.
"""

from __future__ import print_function
from gameutils import print_bold


class Hut:
    """Class to create hut objects in the game Attack of the Orcs"""
    def __init__(self, number, occupant):
        self.occupant = occupant
        self.number = number
        self.is_acquired = False

    def acquire(self, new_occupant):
        """Update the occupant of this hut"""
        self.occupant = new_occupant
        self.is_acquired = True
        print_bold("GOOD JOB! Hut %d acquired" % self.number)

    def get_occupant_type(self):
        """Return a string giving info on the hut occupant"""
        if self.is_acquired:
            occupant_type = 'ACQUIRED'
        elif self.occupant is None:
            occupant_type = 'unoccupied'
        else:
            occupant_type = self.occupant.unit_type

        return occupant_type


"""wargame.hut

This module contains the Hut class implementation.

This module is compatible with Python 3.5.x. It contains
supporting code for the book, Learning Python Application Development,
Packt Publishing.

.. todo::

   The code comments and function descriptions in this file are
   intentionally kept to a minimum! See Chapter 4 of the book to
   learn about the code documentation and best practices!

:copyright: 2016, <NAME>

:license: The MIT License (MIT) . See LICENSE file for further details.
"""

from __future__ import print_function
from gameutils import print_bold


class Hut:
    """Class to create hut objects in the game Attack of the Orcs"""
    def __init__(self, number, occupant):
        self.occupant = occupant
        self.number = number
        self.is_acquired = False

    def acquire(self, new_occupant):
        """Update the occupant of this hut"""
        self.occupant = new_occupant
        self.is_acquired = True
        print_bold("GOOD JOB! Hut %d acquired" % self.number)

    def get_occupant_type(self):
        """Return a string giving info on the hut occupant"""
        if self.is_acquired:
            occupant_type = 'ACQUIRED'
        elif self.occupant is None:
            occupant_type = 'unoccupied'
        else:
            occupant_type = self.occupant.unit_type

        return occupant_type


wargame.hut  This module contains the Hut class implementation.  This module is compatible with Python 3.5.x. It contains supporting code for the book, Learning Python Application Development, Packt Publishing.  .. todo::     The code comments and function descriptions in this file are    intentionally kept to a minimum! See Chapter 4 of the book to    learn about the code documentation and best practices!  :copyright: 2016, <NAME>  :license: The MIT License (MIT) . See LICENSE file for further details. Class to create hut objects in the game Attack of the Orcs Update the occupant of this hut Return a string giving info on the hut occupant