From 4afca6a01e09d01ffbf987d63c86e4ee783bcac0 Mon Sep 17 00:00:00 2001 From: Krzysztof D Date: Sun, 22 May 2022 15:50:30 +0200 Subject: [PATCH] Modification of the program - possibility to run from Visual Studio Code --- scripts/gambit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/gambit.py b/scripts/gambit.py index 0114a3a..ad87b55 100644 --- a/scripts/gambit.py +++ b/scripts/gambit.py @@ -69,6 +69,7 @@ def your_part(data): "l": 25, } +program_path = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) # 2. Program body. This is the part of the program. It could be 1 or 10000 lines. @@ -97,8 +98,8 @@ def first_hand(living_data=None, living_data_name='data'): ''' # Hands. - first_hand = os.getcwd() + '/' + sys.argv[0] - second_hand = first_hand.replace(sys.argv[0], 'second_hand_{}'.format(sys.argv[0])) + first_hand = program_path + '/' + sys.argv[0].split('/')[-1] + second_hand = first_hand.replace(sys.argv[0].split('/')[-1], 'second_hand_{}'.format(sys.argv[0].split('/')[-1])) # Hide second hand. if 'second_hand' in os.listdir(): @@ -131,7 +132,7 @@ def second_hand(): ''' # Hands. - second_hand = os.getcwd() + '/' + sys.argv[0].split('/')[-1] + second_hand = program_path + '/' + sys.argv[0].split('/')[-1] first_hand = second_hand.replace('second_hand_', '') # Move script from second hand back to first.