If destroyer_row != battleship_row and destroyer_row != carrier_row:ĭestroyer_row_start = random.randint(0, 4)ĭestroyer_row_end = destroyer_row_start + 3 Print('If you miss too many times, you lose.')ĭif = input('What difficulty would you like (1-3): ')īattleship_col_start = random.randint(0, 3)īattleship_col_end = battleship_col_start + 4ĭestroyer_col_start = random.randint(0, 4)ĭestroyer_col_end = destroyer_col_start + 3 Print('Hits are marked with Hs and misses are marked with Ms.') Master_break = keyring.get_password('ship', 'break')Įnable = keyring.get_password('ship', 'enable')Īctivate = keyring.get_password('ship', 'activate') How can I simplify this code? import random ![]() ![]() I have used threading to prevent KeyboardInterrupt, so the player can't cheat by using control-c and stuff. I have implemented Battleship in Python by using lists.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |