示例#1
0
            # Empty line so its easier to read
            print("")

            counter = 0
            iAmountOfSteps = 0

            while True:

                iAmountOfSteps += 1

                sSplitLine = linQuestions[counter].split(" -> ")
                sQuestion = sSplitLine[0]
                sNextOptions = sSplitLine[1]

                bAnswer = Input.IsTrue(Input.Ask(sQuestion, ["y", "n"]))

                iParameterToCheck = 0

                if bAnswer == False:
                    iParameterToCheck = 1

                sNextOption = sNextOptions.split(
                    " / ")[iParameterToCheck].strip()

                if sNextOption.isdigit() == True:
                    counter = int(sNextOption)
                    continue

                bGuessCorrect = Input.IsTrue(
                    Input.Ask(
示例#2
0
iEvolutionsPerSecond = 9
iTransparancy = 64  # between 0 and 255, lower means cells stay visible longer
fRainbowSpeed = 0.5
enableRainbow = True
iWidthOfGame = 1000
iHeightOfGame = 1000
iFieldWidth = 100
iFieldHeight = 100

# ------------------------------------------------------
# Ask for user preferred setup
# ------------------------------------------------------

currentLife = None

loadFile = Input.IsTrue(
    Input.Ask("Do you want to load a custom .LIFE file? (y/n)", ["y", "n"]))

if loadFile == True:
    lifFile = open("test.LIF", "r")

    currentLife = MatrixOfLife(iFieldWidth, iFieldHeight, False)
    currentLife.loadlife(lifFile.readlines())

else:
    currentLife = MatrixOfLife(iFieldWidth, iFieldHeight, True)

# ------------------------------------------------------
# Method to redraw the cell
# ------------------------------------------------------