Programming Final: Post 3
This game is a football simulator. As you know it works with the NFL team to try and give you a great experience. In this post you will be able to see all of my source code and at the bottom there will be a zip to download the game and all the files. They are in a folder. Make sure to read the file called Read Me. This will give you everything you need.
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
import random from random import randrange from random import randint import sys from time import sleep win=None loss=None def main(): global win global loss team, overall, selectTeam=select_team() select_players(team, selectTeam) season(overall) game(overall) def welcome(): words = """ ( ) ) ) ( ( )\ ) ( ( /( ( ` ( ) ( /( )\))( ' ( (()/( )\ )\()) )\))( ( ` ) /( )\()) ((_)()\ ) )\ /(_)) (((_) ((_)\ ((_)()\ )\ ( )(_)) ((_)\ _(())\_)()((_) (_)) )\___ ((_) (_()((_) ((_) (_(_()) ((_) \ \((_)/ /| __| | | ((/ __| / _ \ | \/ | | __| |_ _| / _ \ \ \/\/ / | _| | |__ | (__ | (_) | | |\/| | | _| | | | (_) | \_/\_/ |___| |____| \___| \___/ |_| |_| |___| |_| \___/ """ for char in words: sleep(0.00000000000000000001) sys.stdout.write(char) sys.stdout.flush() print (""" ( ) ) ( ( )\ ) ( /( ( /( ) ) ( ( )\ ) )\ ) (()/( )\()) )\()) ` ) /( ( )\ )\ (()/( (()/( /(_)) ((_)\ ((_)\ ( )(_)) )((_) ((((_)( /(_)) /(_)) (_))_| ((_) ((_) (_(_()) ((_)_ )\ _ )\ (_)) (_)) | |_ / _ \ / _ \ |_ _| | _ ) (_)_\(_) | | | | | __| | (_) | | (_) | | | | _ \ / _ \ | |__ | |__ |_| \___/ \___/ |_| |___/ /_/ \_\ |____| |____| ( ( ( ( ) ( )\ ) )\ ) ( ` )\ ) ( ) ) ( /( )\ ) (()/( (()/( )\))( ( (()/( )\ ` ) /( )\()) (()/( /(_)) /(_)) ((_)()\ )\ /(_)) ((((_)( ( )(_)) ((_)\ /(_)) (_)) (_)) (_()((_) _ ((_) (_)) )\ _ )\ (_(_()) ((_) (_)) / __| |_ _| | \/ | | | | | | | (_)_\(_) |_ _| / _ \ | _ \ \__ \ | | | |\/| | | |_| | | |__ / - \ | | | (_) | | / |___/ |___| |_| |_| \___/ |____| /_/ \_\ |_| \___/ |_|_\ """) words = """ ) ) ) ) ( /( ( /( ( /( ( /( )(_)) )\()) )\()) )\()) ((_) ((_)\ ((_)\ ((_)\ |_ ) / (_) / (_) |__ / / / | () | | | / / /___| \__/ |_| /_/ """ for char in words: sleep(0.00000000000000000001) sys.stdout.write(char) sys.stdout.flush() start=input("Type Start to Begin The Game\n") if start=='start': main() if start=='Start': main() else: welcome() def select_team(): print("Teams:") teams=[] fileName = 'teams.csv' inputFile = open(fileName, 'r') for line in inputFile: print(line) teams.append(line) # sleep(0.3) selectTeam=input("Please type your teams number here: ") selectTeam = int(selectTeam) -1 if selectTeam >32: print("You have to enter a value between 1 and 32") main() team = teams[selectTeam] overall=team[-21:] overall=overall[:2] overall=int(overall) team=team[3:] team=team[:-21] print("You have selected the", team) return team, overall, selectTeam def select_players(team, selectTeam): print("Your Starting Roster") fileList=['Arizona Cardinals Lineup.rtf', 'Atlanta Falcons Lineup.rtf', 'Baltimore Ravens Lineup.rtf', 'Buffalo Bills Lineup.rtf', 'Carolina Panthers Lineup.rtf', 'Chicago Bear Lineup.rtf', 'Cincinnati Bengals Lineup.rtf', 'Cleveland Browns Lineup.rtf', 'Dallas Cowboys Lineup.rtf', 'Denver Broncos Lineup.rtf', 'Detroit Lions Lineup.rtf', 'Green Bay Packers Lineup.rtf', 'Houston Texans Lineup.rtf', 'Indianapolis Colts Lineup.rtf', 'Jacksonville Jaguars Lineup.rtf', 'Kansas City Chiefs Lineup.rtf', 'Los Angeles Rams Lineup.rtf', 'Los Angeles Chargers Lineup.rtf', 'Miami Dolphins Lineup.rtf', 'Minnesota Vikings Lineup.rtf', 'New England Patriots Lineup.txt', 'New Orleans Saints Lineup.rtf', 'New York Giants Lineup.rtf', 'New York Jets Lineup.rtf', 'Oakland Raiders Lineup.rtf', 'Philadelphia Eagles Lineup.rtf', 'Pittsburgh Steelers Lineup.rtf', 'San Francisco 49ers Lineup.rtf', 'Seattle Seahawks Lineup.rtf', 'Tampa Bay Buccaneers Lineup.rtf', 'Tennessee Titans Lineup.rtf', 'Washington Redskins Lineup.rtf'] fileName = fileList[selectTeam] inputFile = open(fileName, 'r') for line in inputFile: print(line) def season(overall): global win global loss counter=0 amountOfGames=15 win=0 loss=0 injuryChances=randint(1,16) while counter<=amountOfGames: if counter>=injuryChances: print(injuryChances) injury(overall) injuryChances=100 print('Game', counter+1) game(overall) print('your record is', win, '-', loss) train=input('Would you like to train your team? y/n \n') if train=='y': overall=training(overall) counter=counter+1 print('your final record is', win, '-', loss) anotherOne=input('Would you like to do another season y/n?') if anotherOne=='y': main() def game(overall): global win global loss myScore=0 team1Score=0 teamOverall=randint(70,93) counter2=0 drives=randint(3,10) while counter2<drives: myScore, team1Score=drive(overall,teamOverall, team1Score, myScore) counter2=counter2+1 if myScore>team1Score: print('You won', myScore, 'to', team1Score) win=win+1 if myScore==team1Score: print('GOING INTO OVERTIME. ONE. MORE. DRIVE.') drive(overall, teamOverall, team1Score, myScore) if myScore>team1Score: print('You won', myScore, 'to', team1Score) win=win+1 if team1Score>myScore: print('loss', myScore, 'to', team1Score) loss=loss+1 if team1Score>myScore: print('loss', myScore, 'to', team1Score) loss=loss+1 def drive(overall, teamOverall, team1Score, myScore): luck=randint(overall-20, overall) bluck=randint(teamOverall-20, overall) if luck>bluck: myScore=myScore+7 print('TOUCHDOWN!!!!!!!') else: team1Score=team1Score+7 print('you got scored on') return myScore, team1Score def training(overall): #takes team overall divide by 10 then generate a randiom number between one and int overall, and how close it is to the int you get more point if overall>=69 and overall<=74: originalOverall=overall boomstick=overall/10 boomstick = int(round(boomstick)) addOn=randint(1,7) chance=randint(1,3) if chance>=2: overall=originalOverall+addOn print('your overall has increased from', originalOverall, 'to', overall) else: print('I am sorry, your overall has remained the same.') if overall>=75 and overall<=79: originalOverall=overall boomstick=overall/10 boomstick = int(round(boomstick)) addOn=randint(1,5) chance=randint(1,5) if chance>=3: overall=originalOverall+addOn print('your overall has increased from', originalOverall, 'to', overall) else: print('I am sorry, your overall has remained the same.') if overall>=80 and overall<=89: originalOverall=overall boomstick=overall/10 boomstick = int(round(boomstick)) addOn=randint(1,3) chance=randint(1,5) if chance>=3: overall=originalOverall+addOn print('your overall has increased from', originalOverall, 'to', overall) else: print('I am sorry, your overall has remained the same.') if overall>=90 and overall<=93: originalOverall=overall boomstick=overall/10 boomstick = int(round(boomstick)) addOn=randint(1,1) chance=randint(1,5) if chance>=3: overall=originalOverall+addOn print('your overall has increased from', originalOverall, 'to', overall) else: print('I am sorry, your overall has remained the same.') topOverall=randint(93,100) if overall>topOverall: injury(overall) return overall def injury(overall): print('INJURY!!!!!!!') decrease=randint(3,10) print("Your team's overall has decreased by", decrease) overall=overall-decrease return overall main() |