def main(gameMap = None): #Done And Commented '''THE function that initializes the entire game and runs the game.''' ########################################### Create Game Map ############################################## if gameMap == None: iterable = ["y","n"] demand = "Do you want to generate the map yourself? (y/n):" err = "Your answer was incorectly formated, try again." inp = getInput(demand, err, 0, iterable) if inp == "y": demand = "Input map width and length as two integers seperated by a space:" err = "Your input will not create a board larger than a single tile." width, length = getInput(demand, err, 1) gameMap = Map(True, width, length) win_exp = Algorithm.howWinnable(gameMap) while win_exp[0] is False: gameMap = Map(True, width, length) win_exp = Algorithm.howWinnable(gameMap) else: demand = "Input map width and length as two integers seperated by a space:" err = "Your input will not create a board larger than a single tile." width, length = getInput(demand, err, 1) gameMap = Map(False, width, length) win_exp = Algorithm.howWinnable(gameMap) while win_exp[0] is False: gameMap = Map(False, width, length) win_exp = Algorithm.howWinnable(gameMap) ########################################## Create Character ############################################## char = Character(gameMap) if char.tileOn.requirement == "hill": print("You start with Climbing Gear.") char.gear[0] = "Climbing Gear" elif char.tileOn.requirement == "gate": print("You start with a Gate Key.") char.gear[1] = "Gate Key" ############################################# Play Game ################################################## play(char, gameMap) ############################################## End Game ################################################## if char.tileOn.idx != gameMap.end: print("You ran out of turns. You lose.") else: dump = char.updateChar(math.ceil(1000/(char.charAtk+char.weaponAtk)), Gen.getWeapAsLoot(char), Gen.getReqAsLoot(char)) print("You find, battle, and destroy the boss!") print("You win! You finished with your chararacter being") print("level ", char.level, " and ", char.exp, " experience points in.") print("The computers best was: level", win_exp[1][0], ", experience", win_exp[1][1])