Skip to content

Instantly share code, notes, and snippets.

@Oreolek
Created January 21, 2019 13:56
Show Gist options
  • Save Oreolek/50a81d17585e27e59abacf59223ad55f to your computer and use it in GitHub Desktop.
Save Oreolek/50a81d17585e27e59abacf59223ad55f to your computer and use it in GitHub Desktop.
Plotex example
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from plotex3 import *
class Scenario(ScenarioClass):
Start = State(
money=0,
location='lobby',
costume='none'
)
BecomeFurry = Chain(Has(fursuit=True), Set(costume='fursuit'))
TakeOffCostume = Set(costume='none')
# wandering through the locations
# it is irrelevant how exactly they connect to each other as long as
# there is no puzzle to enter
ToMarket = Set(location='market')
ToLobby = Set(location='lobby')
ToScene = Chain(Has(costume='fursuit'), Set(location='scene'))
EarnMoney = Once(Increment('money'))
EarnMoneyAgain = Once(Increment('money'))
# quests
FindMushroom = Chain(Has(location='lobby'), Once(Set(mushroom=True)))
TradeMushroom = Chain(Has(location='market'), Has(mushroom=True), Once(Set(mushroom=False, weapon=True)))
BuyWeapon = Chain(Has(location='market'), Once(Decrement('money')), Once(Set(weapon=True)))
BuyFursuit = Chain(Has(location='market'), Once(Decrement('money')), Once(Set(fursuit=True)))
# kill enemy
KillEnemy = Chain(Has(location='scene'), Has(weapon=True), Once(Set(killed=True)))
Win = Chain(Has(killed=True), Set(win=True))
# Some unit tests for the scenario:
TestWinnable = Test(can=Has(win=True))
shell(Scenario)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment