about and intro
This commit is contained in:
parent
2263de8a99
commit
19069a8f3f
2 changed files with 26 additions and 15 deletions
|
@ -19,12 +19,13 @@ def animate(n):
|
||||||
sleep(0.2)
|
sleep(0.2)
|
||||||
system('clear')
|
system('clear')
|
||||||
|
|
||||||
|
with open('animation/intro2.txt', 'r') as f:
|
||||||
|
intro_text = f.read()
|
||||||
|
|
||||||
def intro():
|
def intro():
|
||||||
with open('animation/intro2.txt', 'r') as f:
|
|
||||||
anim = f.read()
|
|
||||||
system('clear')
|
system('clear')
|
||||||
print(f'{Fore.MAGENTA}', end='')
|
print(f'{Fore.MAGENTA}', end='')
|
||||||
for ch in anim:
|
for ch in intro_text:
|
||||||
print(ch, end='')
|
print(ch, end='')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sleep(0.01)
|
sleep(0.01)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import os
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
from widgets import *
|
from widgets import *
|
||||||
from state import Table, Hand
|
from state import Table, Hand
|
||||||
|
@ -357,20 +358,20 @@ def main(difficulty, game, dbg=False):
|
||||||
if game.hasEnded:
|
if game.hasEnded:
|
||||||
print(f'{Fore.RED}' + "Game has ended, player '" + game.winner + "' has won"+f'{Style.RESET_ALL}')
|
print(f'{Fore.RED}' + "Game has ended, player '" + game.winner + "' has won"+f'{Style.RESET_ALL}')
|
||||||
else:
|
else:
|
||||||
s = input(f'{Fore.MAGENTA}Do you want to save the game? (y/n)\n')
|
s = input(f'{Fore.MAGENTA}Do you want to save the game? (y/n)\n')
|
||||||
while s.lower() not in ['y', 'yes', 'n', 'no']:
|
while s.lower() not in ['y', 'yes', 'n', 'no']:
|
||||||
s = input(f"{Fore.MAGENTA}Please write 'y' or 'n'\n")
|
s = input(f"{Fore.MAGENTA}Please write 'y' or 'n'\n")
|
||||||
print(f'{Style.RESET_ALL}')
|
print(f'{Style.RESET_ALL}')
|
||||||
if s.lower() == 'y' or s.lower() == 'yes':
|
if s.lower() == 'y' or s.lower() == 'yes':
|
||||||
fname = ''
|
fname = ''
|
||||||
while fname == '':
|
while fname == '':
|
||||||
fname = input('Choose a filename: ')
|
fname = input('Choose a filename: ')
|
||||||
game.dump(fname)
|
game.dump(fname)
|
||||||
print(f'{Style.RESET_ALL}')
|
print(f'{Style.RESET_ALL}')
|
||||||
|
|
||||||
def parse_args(argv):
|
def parse_args(argv):
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description='Octopus Carnival.')
|
parser = argparse.ArgumentParser(description="")
|
||||||
parser.add_argument('--difficulty', type=str, nargs=1, default='medium',
|
parser.add_argument('--difficulty', type=str, nargs=1, default='medium',
|
||||||
help='[easy|medium|hard|n]')
|
help='[easy|medium|hard|n]')
|
||||||
parser.add_argument('--seed', type=int, nargs=1, default=None,
|
parser.add_argument('--seed', type=int, nargs=1, default=None,
|
||||||
|
@ -379,6 +380,8 @@ def parse_args(argv):
|
||||||
help='provide access to the REPL')
|
help='provide access to the REPL')
|
||||||
parser.add_argument('--load', type=str, nargs=1, default='',
|
parser.add_argument('--load', type=str, nargs=1, default='',
|
||||||
help='load a savefile')
|
help='load a savefile')
|
||||||
|
parser.add_argument('--about', action='store_const', const=True,
|
||||||
|
help='information about this game')
|
||||||
|
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
return vars(args)
|
return vars(args)
|
||||||
|
@ -387,7 +390,14 @@ if __name__ == '__main__':
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
args = parse_args(argv[1:])
|
args = parse_args(argv[1:])
|
||||||
print(args)
|
if args['about'] is not None:
|
||||||
|
from animation.octopus import intro_text
|
||||||
|
# print(f'{Fore.MAGENTA}' + intro_text)
|
||||||
|
print(intro_text)
|
||||||
|
print("Press 'd' for drawing a card, m to 'move' a card, 's' to confirm the move.\n")
|
||||||
|
# print(f'{Style.RESET_ALL}')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
diff = args['difficulty'][0]
|
diff = args['difficulty'][0]
|
||||||
d = {'medium':14, 'hard':21, 'easy':7}
|
d = {'medium':14, 'hard':21, 'easy':7}
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue