Code Duplication    Length = 13-13 lines in 2 locations

examples/samples_py.py 2 locations

@@ 766-778 (lines=13) @@
763
        if 0 <= mx < SAMPLE_SCREEN_WIDTH and 0 <= my < SAMPLE_SCREEN_HEIGHT  and \
764
            (self.dx != mx or self.dy != my):
765
            libtcod.console_put_char(sample_console, self.dx, self.dy, self.oldchar,
766
                                     libtcod.BKGND_NONE)
767
            self.dx = mx
768
            self.dy = my
769
            self.oldchar = libtcod.console_get_char(sample_console, self.dx,
770
                                                    self.dy)
771
            libtcod.console_put_char(sample_console, self.dx, self.dy, '+',
772
                                     libtcod.BKGND_NONE)
773
            if SAMPLE_MAP[self.dy][self.dx] == ' ':
774
                self.recalculate = True
775
776
#############################################
777
# bsp sample
778
#############################################
779
bsp_depth = 8
780
bsp_min_room_size = 4
781
# a room fills a random part of the node or the maximum available space ?
@@ 566-578 (lines=13) @@
563
                libtcod.console_put_char(sample_console, self.px, self.py, ' ',
564
                                         libtcod.BKGND_NONE)
565
                self.px += x
566
                self.py += y
567
                libtcod.console_put_char(sample_console, self.px, self.py, '@',
568
                                         libtcod.BKGND_NONE)
569
                self.recompute = True
570
        elif key.c == ord('t'):
571
            self.torch = not self.torch
572
            self.draw_ui()
573
            self.recompute = True
574
        elif key.c == ord('w'):
575
            self.light_walls = not self.light_walls
576
            self.draw_ui()
577
            self.recompute = True
578
        elif key.c in FOV_SELECT_KEYS:
579
            self.algo_num += FOV_SELECT_KEYS[key.c]
580
            self.algo_num %= libtcod.NB_FOV_ALGORITHMS
581
            self.draw_ui()