-
Notifications
You must be signed in to change notification settings - Fork 0
/
func_intro_gameintro.py
executable file
·141 lines (99 loc) · 4.6 KB
/
func_intro_gameintro.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/python3
# intro to game
# team selection
# inital settings
# output draft picks
# number of seasons
from func_other_game_settings import minage,maxage,maxbudget,firstrounddraftpicks,secondrounddraftpicks ,thirdrounddraftpicks ,startseason ,maxskillofinitalteam ,minskillofinitalteam,defaultformation ,squad_size_gk,squad_size_def,squad_size_mid,squad_size_ata
import func_other_header
import os
import func_other_create_players
import func_other_teamreport
import func_other_game_text
import func_other_format_input
import func_other_game_settings
import func_clear_screen
global auto_save_game
auto_save_game=func_other_game_settings.auto_save_game
saved_game_filename="saved_game.txt"
'''
intro to game
team selection
inital settings
'''
def l_game():
# read in file
lseason=lseasonpost=lplayers=ldevelopmentsquad=filecontents = ""
with open(saved_game_filename, 'r') as filehandle:
filecontents = [filehandle.readlines()]
#strip out \n from read in data
#breakpoint()
filecontents2=filecontents[0]
lplayers=[]
ldevelopmentsquad=[]
lseason,lseasonpost,lplayers,ldevelopmentsquad,lprev_season_results=filecontents2
#strip out crap we don't want i.e \n and "
lplayers=eval(lplayers)
ldevelopmentsquad=eval(ldevelopmentsquad)
lseason=eval(lseason)
lseasonpost=eval(lseasonpost)
lprev_season_results=eval(lprev_season_results)
global season
season=lseason
return ("99","99",lplayers,ldevelopmentsquad,lprev_season_results)
def intro(incoming_season, game, defscore, atascore):
'''
Getting the "Intro" section in place...
input= season, game, defscore, atascore
#this calls the welcome screen
players2, newteam = func_other_game_text.intro()
#create out scores
masterdefscore, masteratascore = func_other_teamreport.report(
players, formation, printoutput)
output= masterdefscore, masteratascore, players
'''
global season
season=incoming_season
p_season_results=""
func_clear_screen.clear_screen()
players = func_other_create_players.createplayers(
gk=squad_size_gk, defender=squad_size_def, mid=squad_size_mid, ata=squad_size_ata, qualityofplayer=func_other_game_settings.inital_top_range_player, maxageofplayer=maxage, minageofplayer=minage, ef="123")
development_squad = func_other_create_players.createplayers(gk=2, defender=2, mid=2, ata=2, qualityofplayer=70, maxageofplayer=22, minageofplayer=18, ef="123",developmentsquad="y")
# get team scores for header (this will get updated every off season)
printoutput = "n"
formation = defaultformation
masterdefscore, masteratascore = func_other_teamreport.report(
players, formation, printoutput)
func_other_header.header(status="i", season=season, game=game,
defscore=masterdefscore, atascore=masteratascore)
# newteam helps us work our if players should be used rather than the above default player creation
newteam = 0
exists = os.path.isfile(saved_game_filename)
if exists:
print ("Before we start")
print("I have found a previously saved game,(saved_game.txt)shall i load that game?(y)")
print ("\n***Note this previousley saved game will be overwritten at the end of the the next season***")
load_game_qm=input()
if load_game_qm=="y":
defscore, atascore, players,development_squad,p_season_results = l_game()
masterdefscore, masteratascore = func_other_teamreport.report(players, formation, printoutput)
func_other_header.header(status="i", season=season, game=game,defscore=masterdefscore, atascore=masteratascore)
else:
func_clear_screen.clear_screen()
func_other_header.header(status="i", season=season, game=game,defscore=masterdefscore, atascore=masteratascore)
#this calls the welcome screen
players2, newteam = func_other_game_text.intro()
if newteam == 1:
players = players2
func_clear_screen.clear_screen()
func_other_header.header(status="i", season=season, game=game,
defscore=masterdefscore, atascore=masteratascore)
print("Here is your squad...\n")
func_other_format_input.printplayers(players)
print("\nAnd here is your Development squad...\n")
func_other_format_input.printplayers(development_squad)
input("\nPress a button to continue")
return(masterdefscore, masteratascore, players,development_squad,season,p_season_results)
if __name__ == "__main__":
print ("Testing script...")
intro(season=0, game=0, defscore=20, atascore=50)