Example #1
0
 def select_link(self, state):
     page = state.page()
     self.pages.append(page.title)
     links = list(filter(lambda x: x not in self.pages, page.links))
     if links:
         return rnd(links)
     else:
         return None
Example #2
0
 def select_link(self, state):
     page = state.page()
     self.pages.append(page.title)
     links = list(filter(lambda x: x not in self.pages, page.links))
     if links:
         return rnd(links)
     else:
         return None
Example #3
0
 def say_1180(self):
     self.v_MS = "OK '" + self.v_WSi + "'"
     # XZANFAR
     if self.v_C[3] == 1 and self.v_OB == 34:
         self.v_MS = "* MAGIC OCCUR *"
         if self.v_RM != 45:
             rnd_num = util.rnd(63)
             self.v_RM = rnd_num
     # XZANFAR
     if self.v_C[3] == 1 and self.v_OB == 34 and self.v_RM == 45:
         self.v_F[34] = 1
     return
Example #4
0
def get_food_base():
    """Selects and returns a starting page for food crawling."""
    return rnd(["List of culinary fruits", "List of vegetables"])
Example #5
0
def get_weapon_base():
    """Selects and returns a starting page for weapon crawling."""
    return rnd(["List of premodern combat weapons", "List of medieval weapons"])
Example #6
0
def get_place_base():
    """Selects and returns a starting page for location crawling."""
    return rnd(["Lists of places", "List of buildings and structures"])
Example #7
0
    def read_input(self):
        self.v_MS = "WHAT?"
        self.v_VSi = ""
        self.v_WSi = ""
        self.v_VB = 0
        self.v_OB = 0
        # read user input
        self.v_QSi = input("WHAT WILL YOU DO NOW ? ")
        self.v_QSi = self.v_QSi.upper()
        self.v_QSi = self.v_QSi.strip(' ')

        # show help if empty input
        if not self.v_QSi:
            self.v_QSi = "HELP"

        words = self.v_QSi.split()
        if len(words) == 1:
            self.v_VSi = words[0]
            self.v_WSi = ""  # words[0]
        else:
            self.v_VSi = words[0]
            self.v_WSi = words[1]

        self.trace("-------------------------------------------------")
        self.trace("...read input:")
        self.trace(" 1 read_input v_VSi", self.v_VSi)  # verb

        if self.v_VSi in self.v_VS:
            self.v_VB = self.v_VS.index(self.v_VSi)

        self.trace(" 2 read_input v_VB", self.v_VB)  # verb number
        self.trace(" 3 read_input v_WSi", self.v_WSi)  # word

        if self.v_WSi in self.v_OS:
            self.v_OB = self.v_OS.index(self.v_WSi)

        self.trace(" 4 read_input v_OB", self.v_OB)  # object number

        if self.v_VB == 0 and self.v_OB == 0:
            self.v_MS = "THAT'S SILLY, I don't understand"
            return

        if self.v_WSi == "" and self.v_VB < 24:
            self.v_MS = "I NEED TWO WORDS"

        if self.v_VB > self.v_V and self.v_OB > 0:
            self.v_MS = "YOU CAN'T [" + self.v_QSi + "]"

        if self.v_VB > self.v_V and self.v_OB == 0:
            self.v_MS = "YOU DON'T MAKE SENSE"

        if self.v_VB < self.v_V and self.v_OB > 0 and self.v_C[self.v_OB] == 0:
            self.v_MS = "YOU DON'T HAVE " + self.v_WSi

        rnd_num = util.rnd(4)
        if self.v_F[
                26] == 1 and self.v_RM == 13 and rnd_num != 3 and self.v_VB != 21:
            self.v_MS = "BATS ATTACKING!"
            return

        rnd_num = util.rnd(2)
        if self.v_RM == 44 and rnd_num == 1 and self.v_F[24] != 1:
            self.v_F[27] = 1

        # candle on/off
        if self.v_F[0] == 1:
            self.v_LL = self.v_LL - 1
        if self.v_LL < 1:
            self.v_F[0] = 0

        if self.v_LL == 10:
            self.v_MS = "YOUR CANDLE IS WANING!"
        if self.v_LL == 1:
            self.v_MS = "YOUR CANDLE IS OUT!"

        self.trace("...read input:")
        self.trace("-------------------------------------------------")
Example #8
0
 def select_link(self, state):
     return rnd(state.page().links)
Example #9
0
 def select_link(self, state):
     return rnd(state.page().links)
Example #10
0
def get_food_base():
    """Selects and returns a starting page for food crawling."""
    return rnd(["List of culinary fruits", "List of vegetables"])
Example #11
0
def get_weapon_base():
    """Selects and returns a starting page for weapon crawling."""
    return rnd(
        ["List of premodern combat weapons", "List of medieval weapons"])
Example #12
0
def get_place_base():
    """Selects and returns a starting page for location crawling."""
    return rnd(["Lists of places", "List of buildings and structures"])