def doConstructionPhase(self):
        self.phaseStatus = {}
        phaseActions = CONPHASEACTIONS + self.currFreeActions + [ACTPHASESKIP]
        availableActions = []

        while True:
            availableActions = phaseActions + self._addFreeActions()
            action = self._choiceConstructionPhase(availableActions)
            Output.updateScreen()

            if action == ACTBUILDTHEATER:
                if self._choiceBuildTheaterYN() == YES:
                    self._delMoney(THEATERCOST)
                    self.theaterStack.addCards(Cards.Deck([Cards.Theater(type=PRIVATE, screens=3, status=OPEN)]))
                    self.phaseStatus[THEATERBOUGHT] = True
            elif action == ACTPHASESKIP:
                return True
            Output.updateScreen()
        return True
    def doPrivateBookingPhase(self):
        phaseActions = PVTPHASEACTIONS + self.currFreeActions + [ACTPHASESKIP]
        availableActions = []

        while True:
            availableActions = phaseActions + self._addFreeActions()
            action = self._choicePrivateBookingPhase(availableActions)
            Output.updateScreen()

            if action == ACTPRIVATEBOOK:
                self.doBookMovie(PRIVATE)

            elif action == ACTPHASESKIP:
                Output.updateScreen()
                return True
        Output.updateScreen()
        return True
    def doActionPhaseAction(self):
        phaseActions = ACTPHASEACTIONS + self.currFreeActions + [ACTPHASESKIP]
        availableActions = []
        while True:
            availableActions = phaseActions + self._addFreeActions()
            action = self._choiceActionPhase(availableActions)
            Output.updateScreen()

            if action == ACTBUYSCRIPT:
                currScriptName = self._choiceBuyScriptChoose()[0]
                for i in GENRES:
                    if Game.board.scriptDecks[i].cards[0].name == currScriptName:
                        if self._choiceBuyScriptYN() == YES:
                            self._delMoney(SCRIPTCOST)
                            self.scriptStack.addCards(Game.board.scriptDecks[i].drawCards(names=currScriptName))
                            self.scriptStack.flipAll(FACEUP)

                            Output.updateScreen()
                            return True

            elif action == ACTDRAWACTOR:
                if self._choiceDrawActorYN() == YES:
                    tmpHand = Game.board.actorsDeck.drawCards()
                    if self._choiceBuyActorYN(tmpHand.cards[0]) == YES:
                        self.actorStack.addCards(tmpHand)
                    else:
                        Game.board.employmentOffice.addCards(tmpHand)

                    Output.updateScreen()
                    return True

            elif action == ACTDRAWCRAFT:
                if self._choiceDrawCraftYN() == YES:
                    tmpHand = Game.board.craftsDeck.drawCards()
                    if self._choiceBuyCraftYN(tmpHand.cards[0]) == YES:
                        if tmpHand.cards[0].cardType == DIRECTORCARD:
                            self.directorStack.addCards(tmpHand)
                        elif tmpHand.cards[0].cardType == WRITERCARD:
                            self.writerStack.addCards(tmpHand)
                        elif tmpHand.cards[0].cardType == CREWCARD:
                            self.crewStack.addCards(tmpHand)
                    else:
                        Game.board.employmentOffice.addCards(tmpHand)

                    Output.updateScreen()
                    return True

            elif action == ACTHIREOFFICE:
                currHire = self._choiceHireOffice()[0][0]
                if self._choiceHireYN(currHire) == YES:
                    tmpHand = Game.board.employmentOffice.drawCards(names=currHire)
                    if tmpHand.cards[0].cardType == DIRECTORCARD:
                        self.directorStack.addCards(tmpHand)
                    elif tmpHand.cards[0].cardType == WRITERCARD:
                        self.writerStack.addCards(tmpHand)
                    elif tmpHand.cards[0].cardType == CREWCARD:
                        self.crewStack.addCards(tmpHand)
                    elif tmpHand.cards[0].cardType == ACTORCARD:
                        self.actorStack.addCards(tmpHand)

                    Output.updateScreen()
                    return True

            elif action == ACTPUBLICBOOK:
                if self.doBookMovie(PUBLIC):
                    return True

            elif action == ACTPHASESKIP:
                Output.updateScreen()
                return True

        Output.updateScreen()
        return True
    def doUpkeepPhase(self):
        self.yearStatus = {}
        phaseActions = UPKPHASEACTIONS + [ACTPHASESKIP]
        availableActions = []

        while True:
            availableActions = phaseActions + self._addFreeActions()
            self._updateEmployeeStack()
            action = self._choiceUpkeepPhase(availableActions)
            Output.updateScreen()

            if action in ACTFREEACTIONS:
                self.doFreeAction(action)

            if action == ACTCLAIMSCRIPTS:
                for i in self.writerStack.cards:
                    if i.type == ORDINARYWRITER:
                        while True:
                            currGenre = Dice.genreDie.roll()
                            if Game.board.scriptDecks[currGenre].countCards() > 0:
                                self.scriptStack.addCards(Game.board.scriptDecks[currGenre].drawCards())
                                self.scriptStack.flipAll(FACEUP)
                                break
                    else:
                        currScriptName = self._choiceBuyScriptChoose()[0]
                        for currGenre in GENRES:
                            if Game.board.scriptDecks[currGenre].cards[0].name == currScriptName:
                                self.scriptStack.addCards(Game.board.scriptDecks[currGenre].drawCards(names=currScriptName))
                                self.scriptStack.flipAll(FACEUP)

                # ABILITIES - ALSOWRITER
                for currDirector in self.directorStack.cards:
                    if ALSOWRITER in currDirector.abilities:
                        currScriptName = self._choiceBuyScriptChoose()[0]
                        for currGenre in GENRES:
                            if Game.board.scriptDecks[currGenre].cards[0].name == currScriptName:
                                self.scriptStack.addCards(Game.board.scriptDecks[currGenre].drawCards(names=currScriptName))
                                self.scriptStack.flipAll(FACEUP)

                self.yearStatus[SCRIPTSCLAIMED] = True

            elif action == ACTPAYSALARIES:
                if self._choiceUpkeepPaySalariesYN() == YES:
                    self._delMoney(self._countSalaries())
                    self.yearStatus[EMPLOYEESPAID] = True

            elif action == ACTFIREEMPLOY:
                for currEmployeeName in self._choiceUpkeepFireEmployee():
                    # Add Employee to Employment Office
                    employeeList = self.employeeStack.drawCards(names=currEmployeeName)
                    for currEmployee in employeeList.cards:
                        if currEmployee.cardType == DIRECTORCARD:
                            Game.board.employmentOffice.addCards(self.directorStack.drawCards(names=currEmployeeName))
                        elif currEmployee.cardType == ACTORCARD:
                            Game.board.employmentOffice.addCards(self.actorStack.drawCards(names=currEmployeeName))
                        elif currEmployee.cardType == WRITERCARD:
                            Game.board.employmentOffice.addCards(self.writerStack.drawCards(names=currEmployeeName))
                        elif currEmployee.cardType == CREWCARD:
                            Game.board.employmentOffice.addCards(self.crewStack.drawCards(names=currEmployeeName))
                self._updateEmployeeStack()

            elif action == ACTPAYUPKEEP:
                if self._choiceUpkeepPayUpkeepYN() == YES:
                    self._delMoney(self._countUpkeep())
                    self.yearStatus[UPKEEPPAID] = True
                else:
                    action = ACTCLOSETHEATER

            elif action == ACTOPENTHEATER:
                for currTheaterIndex in self._choiceUpkeepOpenTheater():
                    self._delMoney(THEATERUPKEEP + THEATERREOPEN)
                    self.theaterStack.cards[currTheaterIndex].status == OPEN

            elif action == ACTCLOSETHEATER:
                for currTheaterIndex in self._choiceUpkeepCloseTheater():
                    self.theaterStack.cards[currTheaterIndex].status == CLOSED

            elif action == ACTSELLTHEATER:
                for currTheaterIndex in self._choiceUpkeepCloseTheater():
                    self.theaterStack.drawCards(index=currTheaterIndex)

            elif action == ACTPHASESKIP:
                return True

            Output.updateScreen()

        return True
    def doBookMovie(self, theatre=PUBLIC):
        validScripts = []
        tmpActors = []
        for i in self.scriptStack.cards:
            if self._checkValidScript(i, self.actorStack):
                validScripts.append(i)
        if len(validScripts) > 0:
            currScriptName = self._choiceScriptBook(Cards.Deck(validScripts))[0]
            if self.directorStack.countCards() > 0:
                tmpMovie = Cards.Movie(currScriptName)
                tmpMovie.scriptStack = self.scriptStack.drawCards(names=currScriptName)
                tmpDirector = self._choiceSelectDirector()
                Output.printToLog(str(tmpDirector))
                tmpMovie.directorStack.addCards(self.directorStack.drawCards(names=tmpDirector))
                tmpActors = self._choiceSelectActors(tmpMovie.scriptStack.cards[0])
                Output.printToLog(str(tmpActors))
                if tmpActors:
                    tmpMovie.actorStack.addCards(self.actorStack.drawCards(names=tmpActors))

                    tmpMovie = self._applyAbilitiesBooking(tmpMovie)

                    Output.printToLog(str(Game.board.theaterStack.cards[0].movies.countCards()))
                    Output.printToLog(str(Game.board.theaterStack.cards[0].screens))

                    if theatre == PUBLIC:
                        if Game.board.theaterStack.cards[0].bookMovie(Cards.Deck([tmpMovie])):
                            # Pay movie budget
                            self._delMoney(tmpMovie.budget)
                            # ABILITIES - FREEPUBLICBOOK
                            if FREEPUBLICBOOK not in self.abilities:
                                self._delMoney(1000)
                            self.productionStack[tmpMovie.type].addCards(Cards.Deck([tmpMovie]));
                            Output.printToLog('MOVIE BOOKED')
                            Output.updateScreen()
                            # ABILITIES - BLOCKBOOKING
                            if BLOCKBOOKING not in self.abilities:
                                return True
                        else:
                            Output.printToLog('NO SCREENS AVAILABLE')
                    elif theatre == PRIVATE:
                        for i in self.theaterStack.cards:
                            if i.bookMovie(Cards.Deck([tmpMovie])):
                                # Pay movie budget
                                self._delMoney(tmpMovie.budget)
                                # ABILITIES - FREEPUBLICBOOK
                                if FREEPUBLICBOOK not in self.abilities:
                                    self._delMoney(1000)
                                self.productionStack[tmpMovie.type].addCards(Cards.Deck([tmpMovie]));
                                Output.printToLog('MOVIE BOOKED')
                                Output.updateScreen()
                                # ABILITIES - BLOCKBOOKING
                                if BLOCKBOOKING not in self.abilities:
                                    return True
                            else:
                                Output.printToLog('NO SCREENS AVAILABLE')
                else:
                    Output.printToLog('INVALID SELECTION')
            else:
                Output.printToLog('NO DIRECTORS AVAILABLE')
        else:
            Output.printToLog('NO VALID SCRIPTS')

        self.scriptStack.addCards(tmpMovie.scriptStack)
        self.directorStack.addCards(tmpMovie.directorStack)
        self.actorStack.addCards(tmpMovie.actorStack)
        return False
""" Hollywood Studios v0.3 """

import Cards, Players, CardData, Dice, Game, Output
from Constants import *

Output.initOutput()

Player1 = Players.HumanPlayer("Phil", WAR)

Game.board = Game.Board([Player1])
Game.board.revealScripts()

Output.updateScreen()

Player1.doUpkeepPhase()

for i in range(0,9):

    Output.updateScreen()

    Player1.doConstructionPhase()
    Player1.doActionPhase()
    Player1.doPrivateBookingPhase()

Output.killOutput()

""" SETUP PHASE """

""" YEAR 1 """

"""     TRIM 1 """