X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Futils%2Ffunctest_vacation.py;h=c2e40b07243f98162d97631168cdbea81811df95;hb=5807f2c7d8eb73b11331147de9a240f53b329693;hp=0ba094477a3826ef4879443bf5b31b0854068e58;hpb=6dce2ff0b0bf7e5819eaca161b7e67f954479f1b;p=functest.git diff --git a/functest/utils/functest_vacation.py b/functest/utils/functest_vacation.py index 0ba094477..c2e40b072 100644 --- a/functest/utils/functest_vacation.py +++ b/functest/utils/functest_vacation.py @@ -1,6 +1,6 @@ from os import environ -from curses import initscr, curs_set, newwin, endwin,\ - KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP +from curses import initscr, curs_set, newwin, endwin +from curses import KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP from random import randrange @@ -22,16 +22,16 @@ def main(): body = '~FUNTEST' ind = 0 while key != 27: - win.addstr(0, 44, ' Score: '+str(len(snake)-len(body))+' ') + win.addstr(0, 44, ' Score: ' + str(len(snake) - len(body)) + ' ') win.timeout(140 - 2 * len(snake)) getkey = win.getch() key = key if getkey == -1 else getkey snake.insert( - 0, [snake[0][0]+(key == KEY_RIGHT and 1 or - key == KEY_LEFT and -1), - snake[0][1]+(key == KEY_DOWN and 1 or - key == KEY_UP and -1)]) - win.addch(snake[len(snake)-1][1], snake[len(snake)-1][0], ' ') + 0, [snake[0][0] + (key == KEY_RIGHT and 1 or + key == KEY_LEFT and -1), + snake[0][1] + (key == KEY_DOWN and 1 or + key == KEY_UP and -1)]) + win.addch(snake[len(snake) - 1][1], snake[len(snake) - 1][0], ' ') if win.inch(snake[0][1], snake[0][0]) & 255 == 32: snake.pop() elif win.inch(snake[0][1], snake[0][0]) & 255 == ord('@'): @@ -48,5 +48,6 @@ def main(): print '\nSnake.PY-26lines by Kris Cieslak (defaultset.blogspot.com).' print 'OPNFV adaptation by Functest dream team.' - print 'Thanks for playing, your score: '+str(len(snake)-len(body)-1)+'.' + score = str(len(snake) - len(body) - 1) + print ('Thanks for playing, your score: %s.' % score) print 'Find and fix more bugs in your real OPNFV setup!\n'