예제 #1
0
    def box(self, txt):
        """Center text and display border around it."""
        in_width = width - 2  # inside width
        tpl = border.vertical + '%s' + border.vertical

        topline = border.tl + border.horiz * in_width + border.tr
        btmline = border.bl + border.horiz * in_width + border.br
        padline = tpl % (space * in_width)

        wrapped = [line for line in wrap(txt, width - 10)]
        wrapped = [tpl % l.center(in_width) for l in wrapped]
        lines = [topline, padline] + wrapped + [padline, btmline]

        print(nl.join(space + l for l in lines))
예제 #2
0
파일: flashcards.py 프로젝트: Voder/PBE
    def box(self, txt):
        """Center text and display border around it."""
        in_width = width - 2    # inside width
        tpl      = border.vertical + '%s' + border.vertical

        topline  = border.tl + border.horiz * in_width + border.tr
        btmline  = border.bl + border.horiz * in_width + border.br
        padline  = tpl % (space * in_width)

        wrapped  = [line for line in wrap(txt, width - 10)]
        wrapped  = [tpl % l.center(in_width) for l in wrapped]
        lines    = [topline, padline] + wrapped + [padline, btmline]

        print( nl.join(space+l for l in lines) )
예제 #3
0
파일: adv.py 프로젝트: Voder/PBE
    def move(self, ndir):
        if not self.dir.doors[ndir]:
            print(Msg.bump_wall)
            return

        M = [Msg.ent_room]    # messages for the player
        self.dir.update(ndir)
        newloc    = board.nextloc(self, self.dir.absdir)
        self.room = Room(newloc) if board.empty(newloc) else board[newloc]

        board.move(self, newloc)
        self.dir.update_doors()
        self.roomview(M)

        if self.room.shaky_floor and any(i.anvil for i in self.items):
            self.next_level(M)

        print(nl.join(M))
예제 #4
0
    def move(self, ndir):
        if not self.dir.doors[ndir]:
            print(Msg.bump_wall)
            return

        M = [Msg.ent_room]  # messages for the player
        self.dir.update(ndir)
        newloc = board.nextloc(self, self.dir.absdir)
        self.room = Room(newloc) if board.empty(newloc) else board[newloc]

        board.move(self, newloc)
        self.dir.update_doors()
        self.roomview(M)

        if self.room.shaky_floor and any(i.anvil for i in self.items):
            self.next_level(M)

        print(nl.join(M))
예제 #5
0
    def get_badges(self, level):
        level = iround(level*badge_modifier)
        lines = self.advanced_badges(level) + [ self.basic_badges(level) ]
        lines = [space.join(line) for line in lines]

        return nl.join(l.center(16) for l in lines if l)
예제 #6
0
파일: adv.py 프로젝트: Voder/PBE
 def look(self):
     print(nl*5)
     print(nl.join(self.roomview()))
예제 #7
0
 def look(self):
     print(nl * 5)
     print(nl.join(self.roomview()))