Beispiel #1
0
    def reset(self, old_scene=None, screen=None):
        centre = (self._screen.width // 2, self._screen.height // 2)
        text = Figlet(font="banner", width=200).renderText("ChafNut Games")
        width = max([len(x) for x in text.split("\n")])

        effects = [
            Print(self._screen,
                  Fire(20, width, text, .4, 40, self._screen.colours),
                  x=centre[0] - 40,
                  y=centre[1] - 30,
                  speed=1,
                  transparent=False),
            Print(self._screen,
                  FigletText("ChafNut Games", "banner"),
                  x=centre[0] - 40,
                  y=centre[1] - 12,
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_WHITE,
                  speed=1),
            Print(self._screen,
                  FigletText("Michael Robinson \n Matt Mulhern", "thin"),
                  x=centre[0] - 20,
                  y=centre[1],
                  colour=Screen.COLOUR_WHITE,
                  bg=Screen.COLOUR_BLACK,
                  speed=1)
        ]

        for fx in effects:
            self.add_effect(fx)
Beispiel #2
0
def demo(screen):
    # Typical terminals are 80x24 on UNIX and 80x25 on Windows
    f = Figlet(font='slant')

    effects = [
        Cog(screen, 20, 10, 10),
        Cog(screen, 60, 25, 15, direction=-1),
        Print(screen,
              FigletText(f.renderText(secure_random.choice(autoTeam)),
                         font="term"),
              x=45,
              y=22,
              start_frame=60)
    ]

    effects.append(
        Print(screen,
              FigletText(f.renderText('Super team na dzis:'), font='term'),
              x=90,
              y=int(0)))
    currentMemberIndex = 1
    for member in autoTeam:
        effects.append(
            Print(screen,
                  FigletText(f.renderText(member), font='term'),
                  x=120,
                  y=int(7 * currentMemberIndex) + 2))
        currentMemberIndex += 1

    screen.play([Scene(effects, -1)], stop_on_resize=True)
Beispiel #3
0
def demo(screen):
    # Typical terminals are 80x24 on UNIX and 80x25 on Windows
    if screen.width != 80 or screen.height not in (24, 25):
        effects = [
            Print(screen,
                  FigletText("Resize to 80x24"),
                  y=screen.height // 2 - 3),
        ]
    else:
        effects = [
            Cog(screen, 20, 10, 10),
            Cog(screen, 60, 30, 15, direction=-1),
            Print(screen,
                  FigletText("ascii", font="smkeyboard"),
                  attr=Screen.A_BOLD,
                  x=47,
                  y=3,
                  start_frame=50),
            Print(screen,
                  FigletText("matics", font="smkeyboard"),
                  attr=Screen.A_BOLD,
                  x=45,
                  y=7,
                  start_frame=100),
            Print(screen,
                  FigletText("by Peter Brittain", font="term"),
                  x=8,
                  y=22,
                  start_frame=150)
        ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
Beispiel #4
0
def demo(screen):
    scenes = []
    cell1 = Rainbow(screen,
                    RotatedDuplicate(screen.width // 2,
                                     max(screen.width // 2, screen.height),
                                     FigletText("ASCII" if screen.width < 80 else "ASCII rules",
                                                font="banner",
                                                width=screen.width // 2)))
    cell2 = ""
    size = int(sqrt(screen.height ** 2 + screen.width ** 2 // 4))
    for _ in range(size):
        for x in range(size):
            c = x * screen.colours // size
            cell2 += "${%d,2,%d}:" % (c, c)
        cell2 += "\n"
    for i in range(8):
        scenes.append(
            Scene([Print(screen,
                         Kaleidoscope(screen.height, screen.width, cell1, i),
                         0,
                         speed=1,
                         transparent=False),
                   Print(screen,
                         FigletText(str(i)), screen.height - 6, x=screen.width - 8, speed=1)],
                  duration=360))
        scenes.append(
            Scene([Print(screen,
                         Kaleidoscope(screen.height, screen.width, StaticRenderer([cell2]), i),
                         0,
                         speed=1,
                         transparent=False)],
                  duration=360))
    screen.play(scenes, stop_on_resize=True)
Beispiel #5
0
def run(screen):
    scenes = []
    centre = (screen.width // 2, screen.height // 2)

    # Intro
    effects = [
        Stars(screen, (screen.width + screen.height) // 2, start_frame=0),
        Print(
            screen,
            FigletText(
                """I’m afraid sometimes you’ll play lonely games too, games you can’t win because
              you’ll play against you."""),
            x=centre[0] - 100,
            y=centre[1] - 20,
            clear=True,
            start_frame=0,
            stop_frame=200),
        Print(screen,
              Rainbow(screen, FigletText("Press <SPACE> to start")),
              x=centre[0] - 100,
              y=centre[1] - 20,
              clear=True,
              start_frame=200,
              stop_frame=2000),
    ]

    scenes.append(Scene(effects, -1))

    # Scene 1, start the game
    side_panel = [
        Print(screen,
              Box(screen.width // 5, screen.height, uni=screen.unicode_aware),
              0,
              0,
              start_frame=0),
        Print(screen,
              FigletText("Side", font="big"),
              x=0,
              y=1,
              clear=True,
              start_frame=0,
              stop_frame=100),
    ]

    effects = [
        Print(screen,
              Box((screen.width // 5) * 4,
                  screen.height,
                  uni=screen.unicode_aware),
              0,
              screen.width // 5,
              start_frame=0),
    ]

    final = side_panel + effects
    scenes.append(Scene(final, -1))
    screen.refresh()
    # sleep(100)

    screen.play(scenes, stop_on_resize=True)
Beispiel #6
0
def day1_1(screen):
    inputs = [
        int(x) for x in open("/Users/ciaran.whyte/dev/aoc2020/day1/input.txt").
        read().splitlines()
    ]

    for idx, num in enumerate(inputs):
        c_one = idx
        for idx_two, c_two in enumerate(inputs[idx:]):
            update_visual(screen, inputs, c_one, idx + idx_two)

            if c_two + num == 2020:
                # centre = (screen.width // 2, screen.height // 2)
                # screen.print_at(text=f"{num} + {c_two} == 2020", x=centre[0], y=centre[1], colour=0, bg=13)
                # screen.print_at(text=f"{num} * {c_two} == {num * c_two}", x=centre[0]+1, y=centre[0]+1, colour=3, bg=0)
                # screen.refresh()
                # screen.close()
                effects = [
                    Cycle(screen,
                          FigletText(f"{num} + {c_two} == 2020", font='big'),
                          int(screen.height / 2 - 8)),
                    Cycle(
                        screen,
                        FigletText(f"{num} * {c_two} == {num * c_two}",
                                   font='big'), int(screen.height / 2 + 3)),
                    Stars(screen, 200)
                ]
                screen.play([Scene(effects, 500)])
                time.sleep(5)
                return
Beispiel #7
0
 def _seq(self, screen, scene):
     scenes = []
     banner_pos = (screen.width - 100) // 2 + 20
     static_image = [
         Print(screen,
               ColourImageFile(screen,
                               op.join(DIRNAME, "assets", "images",
                                       "ibm1620.jpg"),
                               screen.height,
                               uni=screen.unicode_aware),
               y=0,
               speed=1,
               stop_frame=(21 + screen.height) * 2),
         Print(screen,
               FigletText("PyPadberg", "banner"),
               screen.height - 8,
               x=banner_pos,
               colour=Screen.COLOUR_BLACK,
               bg=Screen.COLOUR_BLACK,
               speed=1),
         Print(screen,
               FigletText("PyPadberg", "banner"),
               screen.height - 9,
               x=(banner_pos + 1),
               colour=Screen.COLOUR_WHITE,
               bg=Screen.COLOUR_WHITE,
               speed=1),
     ]
     scenes.append(Scene(static_image, name="intro2"))
     scenes.append(Scene([TextFormFrame(screen)], -1, name="text_entry"))
     scenes.append(
         Scene([ProcessingFrame(screen)], -1, name="display_processing"))
     final_frame = [Julia(screen), FinalFrame(screen)]
     scenes.append(Scene(final_frame, -1, name="end_menu"))
     screen.play(scenes, stop_on_resize=True, start_scene=scene)
Beispiel #8
0
def play_welcome(screen):
    scenes = []

    logo = '''
         ░░░░░░░░░░░░░░░░░░░
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
       ▒▒▒▒    ╱ o o ╲    ▒▒▒▒
   ▓▓▓ ▒▒▒▒    ╲_╰─╯_╱    ▒▒▒▒ ▓▓▓
      ╲▒▒▒▒     ╱   ╲     ▒▒▒▒╱
       ░░░░░░░░░░░░░░░░░░░░░░░
       ▓▓╳╳▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╳╳▓▓
       ▓▓▓▓▓═╣╠═╣╠═╣╠═╣╠═▓▓▓▓▓
       ▓▓▓▓╠═╣╠═╣╠═╣╠═╣╠═╣▓▓▓▓
       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
          ╿___╿       ╿___╿'''

    Welcome = 'Welcome to this program\npress x to continue'

    effects = [
        Print(screen, StaticRenderer(images=[logo]), 2),
        Print(screen, FigletText('Car Rental', font='big'), 14),
        Print(screen,
              FigletText('The BEST!', font='small'),
              20,
              colour=Screen.COLOUR_GREEN),
        Print(screen, StaticRenderer(images=[Welcome]), 25)
    ]
    scenes.append(Scene(effects, 0))

    screen.play(scenes, stop_on_resize=True, repeat=True)
def demo(screen):
    scenes = []
    effects = [
        Print(screen,
              FigletText("JOGET BRO",
                         font='banner3' if screen.width > 80 else 'banner'),
              screen.height//2-3,
              colour=7, bg=7 if screen.unicode_aware else 0),
    ]
    scenes.append(Scene(effects))
    effects = [
        Print(screen,
              ColourImageFile(screen, "joget.gif", screen.height,
                              uni=screen.unicode_aware),
              screen.height,
              speed=1),
        Scroll(screen, 2)
    ]
    scenes.append(Scene(effects))
    effects = [
        BannerText(screen,
                   ColourImageFile(screen, "joget.gif", screen.height-2,
                                   uni=screen.unicode_aware, dither=screen.unicode_aware),
                   0, 0),
    ]
    scenes.append(Scene(effects))
    effects = [
        Print(screen,
              FigletText("THANKS",
                         font='banner3' if screen.width > 80 else 'banner'),
              screen.height//2-3,
              colour=7, bg=7 if screen.unicode_aware else 0),
    ]
    scenes.append(Scene(effects))
    screen.play(scenes, stop_on_resize=True)
Beispiel #10
0
def lose_animation(screen):
    effects = [
        Print(screen, FigletText("YOU", font='big'), y=screen.height // 2 - 8),
        Print(screen, FigletText("LOST", font='big'),
              y=screen.height // 2 + 3),
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
Beispiel #11
0
 def internal_checks(screen):
     screen.play([
         Scene([
             MockEffect(count=5),
             Print(screen, FigletText("hello"), 2),
             Cycle(screen, FigletText("world"), 6),
             BannerText(screen, FigletText("world"), 10, 3),
             Mirage(screen, FigletText("huh?"), 14, 2)], 0)])
Beispiel #12
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("Dan  is  the  best", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("", font='big'), int(screen.height / 2)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #13
0
 def doit(screen):
     effects = [
         Cycle(screen, FigletText("You", font='big'),
               int(screen.height / 2 - 8)),
         Cycle(screen, FigletText("Won!", font='big'),
               int(screen.height / 2 + 3)),
         Stars(screen, 200)
     ]
     screen.play([Scene(effects, 5000)])
Beispiel #14
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("ASCIIMATICS", font='big'),
              screen.height // 2 - 8),
        Cycle(screen, FigletText("ROCKS!", font='big'),
              screen.height // 2 + 3),
        Stars(screen, (screen.width + screen.height) // 2)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #15
0
def WelcomeMsg(screen):
    effects = [
        Cycle(screen, FigletText("ROBOCOP", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("cop without gun", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 20)], repeat=False)
Beispiel #16
0
 def title_screen_graphics(self, screen):
     effects = [
         Cycle(screen, FigletText("Cat", font='univers'),
               screen.height // 2 - 8),
         Cycle(screen, FigletText("Quest", font='univers'),
               screen.height // 2 + 3),
         Stars(screen, (screen.width + screen.height) // 2)
     ]
     screen.play([Scene(effects, 66)], repeat=False)
Beispiel #17
0
def display(screen):
    effects = [
        Cycle(screen, FigletText("WELCOME TO", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("PYCON-NG 2019!", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #18
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("HALFWAY", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("CROOKS", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #19
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("wheh", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("nice!", font='big'),
              int(screen.height / 2 + 3)),
        FlipStars(screen, 70)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #20
0
    def _render_now(self):
        try:
            score = (0 if lastframe is None else
                     lastframe["teams"][self.team]["stats"]["points"])

            return FigletText(str(score).rjust(2, "0"),
                              font=self.font).rendered_text
        except:
            return FigletText(str(0), font=self.font).rendered_text
Beispiel #21
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("Twitter", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("Bot!", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #22
0
def demo(screen):
    effects = [
        Print(screen, Rainbow(screen, FigletText("256 colours")),
              y=screen.height//2 - 8),
        Print(screen, Rainbow(screen, FigletText("for xterm users")),
              y=screen.height//2 + 3),
        Clock(screen, screen.width//2, screen.height//2, screen.height//2),
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
Beispiel #23
0
def win_animation(screen):
    effects = [
        Cycle(screen, FigletText("YOU", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("WON", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #24
0
def ascii_greeter(screen):
    effects = [
        Cycle(screen, FigletText("StereoStrand", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("ROCKS!", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 100)], repeat=False)
Beispiel #25
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("SANDER", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("ROCKS!", font='big'),
              int(screen.height / 2 + 3)),
        Stars(screen, 200)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #26
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("TABLE TENNIS", font='big'),
              screen.height // 2 - 8),
        Cycle(screen, FigletText("SCOREBOARD", font='big'),
              screen.height // 2 + 3),
        Stars(screen, (screen.width + screen.height) // 2)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #27
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("We4theRep0rt", font='big'),
              int(screen.height / 2 - 8)),
        Cycle(screen, FigletText("The best has yet to come", font='small'),
              int(screen.height / 2 + 3)),
        Stars(screen, 600)
    ]

    screen.play([Scene(effects, 500)])
def demo(screen):
    effects = [
        Print(screen, Rainbow(screen, FigletText("Hacktoberfest")),
              y=screen.height//2 - 8),
        Print(screen, Rainbow(screen, FigletText("ASCII Art 2020")),
              y=screen.height//2 + 3),
        Clock(screen, screen.width//2, screen.height//2, screen.height//2),
    ]
    screen.play([Scene(effects, -1)], stop_on_resize=True)
    screen.refresh()
Beispiel #29
0
def demo(screen):
    effects = [
        Cycle(screen, FigletText("P Y T H O N", font='big'),
              screen.height // 2 - 8),
        Cycle(screen, Fire(screen.height, screen.width, 'O', 0.5, 50, 5),
              screen.height // 2 + 3),
        Snow(screen),
        Mirage(screen, FigletText("R O C K S ! ! !"), screen.height // 2 + 3,
               2)
    ]
    screen.play([Scene(effects, 500)])
Beispiel #30
0
def demo(screen=None, output1="", output2=""):

    effects = [
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output1)))),
              screen.height // 2 - 7),
        Print(screen, Rainbow(screen, FigletText("{}".format(str(output2)))),
              screen.height // 2),
        Stars(screen, (screen.width + screen.height) // 2)
    ]

    screen.play([Scene(effects, 500)])