예제 #1
0
def test_boardDisplayNotExplicit():
    test = Fen('rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2')
    y = test.boardToArray('rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R')
    assert y == ['  \x1b[31mr   \x1b[0m\x1b[31mn   \x1b[0m\x1b[31mb   \x1b[0m\x1b[31mq   \x1b[0m\x1b[31mk   \x1b[0m\x1b[31mb   \x1b[0m\x1b[31mn   \x1b[0m\x1b[31mr   \x1b[0m\n',
        '  \x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m.   \x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\n',
        '  .   .   .   .   .   .   .   .   \n',
        '  .   .   .   .   \x1b[31mp   \x1b[0m.   .   .   \n',
        '  .   .   .   .   P   .   .   .   \n',
        '  .   .   .   .   .   N   .   .   \n',
        '  P   P   P   P   .   P   P   P   \n',
        '  R   N   B   Q   K   B   .   R   \n']
    test.displayBoard()
    z = test.augmentBoard()
    assert z == ['\x1b[32m\n        a   b   c   d   e   f   g   h  \n\x1b[0m',
    '\x1b[32m  8   \x1b[0m  \x1b[31mr   \x1b[0m\x1b[31mn   \x1b[0m\x1b[31mb   \x1b[0m\x1b[31mq   \x1b[0m\x1b[31mk   \x1b[0m\x1b[31mb   \x1b[0m\x1b[31mn   \x1b[0m\x1b[31mr   \x1b[0m\n',
    '\x1b[32m  7   \x1b[0m  \x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m.   \x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\x1b[31mp   \x1b[0m\n',
    '\x1b[32m  6   \x1b[0m  .   .   .   .   .   .   .   .   \n',
    '\x1b[32m  5   \x1b[0m  .   .   .   .   \x1b[31mp   \x1b[0m.   .   .   \n',
    '\x1b[32m  4   \x1b[0m  .   .   .   .   P   .   .   .   \n',
    '\x1b[32m  3   \x1b[0m  .   .   .   .   .   N   .   .   \n',
    '\x1b[32m  2   \x1b[0m  P   P   P   P   .   P   P   P   \n',
    '\x1b[32m  1   \x1b[0m  R   N   B   Q   K   B   .   R   \n']
    test.displayBoard()
예제 #2
0
    # -----------------------------------------------------------------------------
    if selection == 'a':
        print('pre-set test\n')
        test = Fen(
            'rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2')
        # arguments given
        w = test.boardToString(
            board='rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R')
        print('The simplest board representation looks like this ...\n')
        test.displayBoardString(w)
        print('\n')
        wait = input('press any key to continue\n')
        print('This adds colour...\n')
        x = test.boardToArray(
            board='rnbqkbnr/pppp1ppp/8/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R')
        test.displayBoard(x)
        wait = input('press any key to continue\n')
        print('This adds rank and file markers...\n')
        y = test.augmentBoard(x)
        test.displayBoard(y)
        wait = input('press any key to continue\n')
        print('\n')
        print("""

self input test

Please input the board element of a fen
and check the display.

    """)
        print("""