def render(board: list, moves: list): """ mutate the board, then render it """ for p in moves: theplay = p[1] l = len(theplay) comp = re.compile('([KQBNRP])?([a-h][1-8])(x?)([a-h][1-8])([\+#]?)') mat = comp.match(theplay) grps = mat.groups(0) frm = grps[1] frm_col = colval(frm[0]) frm_row = rowval(frm[1]) to = grps[3] to_col = colval(to[0]) to_row = rowval(to[1]) frm_piece = board[frm_row][frm_col] to_piece = board[to_row][to_col] board[to_row][to_col] = board[frm_row][frm_col] board[frm_row][frm_col] = '' for row in board[::-1]: for cell in row: if len(cell) > 0: if islower(cell): print(f" {white}{black_back}{cell}{reset_color}", end='') elif isupper(cell): print(f" {red}{black_back}{cell}{reset_color}", end='') else: print(f" {black_back}-{reset_color}", end='') print('')
def test_board_shortname_in_correct_format(self): """ Board shortnames should only represent themselves in lowercase, alphanumeric characters. """ board = create_board("Bacon", "b") self.assertTrue(islower(board.shortname)) self.assertTrue(isalpha(board.shortname))
def cipher(inputStr): answer = [] for c in inputStr: if islower(c): answer.append(chr(219 - ord(c))) else: answer.append(c) return "".join(answer)
def process(stdscr): while True: inp = stdscr.getch() if inp == CTRL_X: quit(stdscr) elif inp == CTRL_F: sendFile(stdscr) elif inp != curses.ERR: if ascii.islower(inp): inp = inp - 32 # to upper case send(inp) readDisplayAll(stdscr)
def render(board: list, moves: list): """ mutate the board, then render it """ for p in moves: theplay = p[1] l = len(theplay) comp = re.compile('([KQBNRP])?([a-h][1-8])(x?)([a-h][1-8])([\+#]?)') mat = comp.match(theplay) grps = mat.groups(0); frm = grps[1] frm_col = colval(frm[0]) frm_row = rowval(frm[1]) to = grps[3] to_col = colval(to[0]) to_row = rowval(to[1]) frm_piece = board[frm_row][frm_col] to_piece = board[to_row][to_col] board[to_row][to_col] = board[frm_row][frm_col] board[frm_row][frm_col] = '' therow = 8 for i, row in enumerate(board[::-1]): print(f'<tr><td class="cell-legend">{therow-i}</td>') for cell in row: if len(cell) > 0: if islower(cell): print(f" <td class='cell white-black'><img src='{imgsrc(cell)}' alt='{cell}'/></td>", end='') elif isupper(cell): print(f" <td class='cell red-black'><img src='{imgsrc(cell)}' alt='{cell}'/></td>", end='') else: print(f" <td class='cell silver-black'>-</td>", end='') print('</tr><tr>') print("<td class='cell-legend'> </td>"); for letter in range(97, 97+8): print(f"<td class='cell-legend'>{chr(letter).upper()}</td>") print('</tr>')
from curses.ascii import islower metin = input('Metin girin: ') karakterler = list(metin) for i in karakterler: if islower(i): i = i.upper() print(f'{i} : {ord(i)}') else: print(f'{i} : {ord(i)}')
def test_board_name_in_correct_format(self): """ Board names should saved in lowercase, regardless of what a user may enter. """ board = create_board("UpAnDdOwNwEgO", "u") self.assertTrue(islower(board.name))
def test_board_unicode_in_correct_format(self): """ Board unicode representation should be in lowercase. """ board = create_board("Yachts", "y") self.assertTrue(islower(board.__unicode__()))
pass_db = path_from_script(__file__, '../../data/crackstation-human-only.txt') pass_db = '/usr/share/dict/cracklib-small' fil = path_from_script(__file__, './dogecrypt-b36f587051faafc444417eb10dd47b0f30a52a0b') #fil = '/tmp/test.abc' with open(fil, 'rb') as f: content = f.read() content = content[12:] x = crypto.Cracker() mode = crypto.ZipState() checker = crypto.AsciiChecker() x.set_state(mode) x.set_content(content) x.set_checker(checker) charset = ' ' for y in range(0, 128): c = chr(y) if islower(c): charset += c #x.do_bruteforce(charset, 4) x.do_dictionary(pass_db)