Created
August 11, 2023 15:08
-
-
Save quincynyan/8b9f3bff1177ab90c0a0e552501b8e59 to your computer and use it in GitHub Desktop.
This Python code generates a random lineup for a football (soccer) team. It defines a formation and player positions, and then assigns players to each position randomly. It also chooses a captain and a manager randomly. Finally, it prints out the lineup and some information about the team.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import random | |
# print("You'll have 433 formation") | |
# ST = ["C.Ronaldo","Benzema","E.Haaland","K.Mbbape","Ronaldo","R.VanPerSie", | |
# "W.Rooney","C.Tevez","R.Lewondoski","L.Suarez","O.Giroud","S.Aguro"] | |
# LW = ["Rashford","NeymarJr","VinicusJr","SonHeungMin","JackGrealish","S.Mane", | |
# "L.Sane","K.Coman","K.Kvaratskhelia","E.Hazard","F.Ribery","P.Foden"] | |
# RW = ["Antony","L.Messi","M.Salah","A.Robbens","R.Mahrez","A.DiMaria", | |
# "M.Asensio","H.Ziyech","L.Figo","Garrincha","G.Best","G.Bale"] | |
# CM =["Modric","Kross","R.Giggs","B.Robson","P.Scholes","D.Beckhem","JS.Park","A.Herrera", | |
# "Eriksen","B.Fernandes","Anderson","Powell","S.Kagawa","K.DeBruyne","Guandogan","Tiago", | |
# "VanDeBeek","F.DeJong","Kovacic","Mount","R.Neves","A.MacAllister","Fred","McTomminay"] | |
# CDM =["Casemiro","Rodri","DePaul","S.Busquest","D.Rice","Kante", | |
# "A.Tchoumeni","J.Kimmich","Fabinho","T.Partey","E.Davids","P.Veria", | |
# "R.Keane","C.Makelele","D.Deschamps","D.Simeone","Kheidra","L.Matthaus", | |
# "M.Caicedo",] | |
# CB =["Maguire","Koulibaily","TiagoSilva","Maguire","R.Ferdinand","Vidic","VanDijk","Maguire", | |
# "Moore","Matip","KimMinJae","Lindelof","R.Dias","Ake","B.White","Saliba", | |
# "LissandroMartinez","R.Varane","Deligt","Matip","Pique","Marsherano","Puyol", | |
# "Ramos","Pepe","E.Militao","Alaba","R.Arujo","Bastoni","Acerbi","V.Ruiz" | |
# "Canavaro","Upacameo","N.Sule","P.Jones","Marquinhos"] | |
# LRB =["DaniAlves","D.Dalot","W.Bissaka","Trippier","J.Cancelo","ReeceJames","T.AlexanderArnold","Rafeal", | |
# "Azpilicueta","N.Mazraoui","WalkerPeters","Dumfries","JuanCuadrado","D.Carvajal","Pavard","Hakimi"] | |
# GK = ["I.Casillas","G.Buffon","V.Valdes","D.Degea","J.Hart","D.Henderson","Pickford","Raya","Yashin","Romero","VanDerSarr","P.Cech","TerStegan","M.Nuer","Y.Sommer","Kepa","Donarruma","K.Navas","T.Coutoris","SanchezGK","Ramsdale","Ederson","Alisson","Karius"] | |
# ManagerPack = ["AlexFerguson","ArsenWenger","PepGuardiola","CarlosAncellotti","JoseMorinho","LuisVanHaal","MattBusby","EricTenHag","Scaloni"] | |
# CoachPack = ["Arteta","FrankLampard","DeZerbi","GrahamPotter","JurgenKlopp","Pochettino","ThomasTuchel","DavidMoyes","NunoSantos"] | |
# RelgationSaversPack = ["Shawn Dyce","Big Sam","RoyHodgson"] | |
# #picking | |
# Striker = random.choice(ST) | |
# Wingerp1 = random.choice([LW]) | |
# Winger1 =random.choice(Wingerp1) | |
# Wingerp2 = random.choice([RW]) | |
# Winger2 = random.choice(Wingerp2) | |
# Midp1 = random.choice([CM]) | |
# Mid1 = random.choice(Midp1) | |
# Midp2 = random.choice([CDM]) | |
# Mid2 = random.choice(Midp2) | |
# Midp3 = random.choice([CM]) | |
# Mid3 = random.choice(Midp3) | |
# CB1 =random.choice(CB) | |
# CB2 = random.choice(CB) | |
# LRB1 = random.choice(LRB) | |
# LRB2 = random.choice(LRB) | |
# GK1 = random.choice(GK) | |
# pickM1 = random.choice([ManagerPack,CoachPack,RelgationSaversPack]) | |
# randompickM1 = random.choice(pickM1) | |
# pc = [Striker,Winger1,Winger2,Mid1,Mid2,Mid3,LRB1,CB1,CB2,LRB2,GK1] | |
# captain = random.choice(pc) | |
# #display | |
# print(randompickM1,"'s Starting Line Up") | |
# print("------",Striker,"------") | |
# print("-",Winger1,"--------",Winger2,"-") | |
# print("--",Mid1,"------",Mid3,"--") | |
# print("------",Mid2,"------") | |
# print("-",LRB1,"--------",LRB2,"-") | |
# print("---",CB1,"----",CB2,"----") | |
# print("------",GK1,"------") | |
# print("The main man leading the attack is",Striker) | |
# print("and",Striker,"will be paired with", Winger1, "and", Winger2,"in wing position") | |
# print("The midfield engine will be run by",Mid1,",",Mid2,"and ",Mid3) | |
# print(CB1,"and",CB2,"stand solid in center back position") | |
# print("Don't forget about",LRB1,"and",LRB2,"as they are going to provide dangerous crosses to opposition box") | |
# print("at last",GK1,"'s wall of steel guards the goal") | |
# print("and this particular team will be lead by",captain,"as captain") | |
# print("can",randompickM1,"lead this team to victory?") | |
import random | |
print("You'll have 433 formation") | |
# Define the formation and player positions | |
formation = { | |
"ST": 1, | |
"LW": 1, | |
"RW": 1, | |
"CM": 3, | |
"CDM": 1, | |
"CB": 4, | |
"LRB": 2, | |
"GK": 1 | |
} | |
# Define the players for each position | |
players = { | |
"ST": ["C.Ronaldo", "Benzema", "E.Haaland", "K.Mbbape", "Ronaldo", "R.VanPerSie", "W.Rooney", "C.Tevez", "R.Lewondoski", "L.Suarez", "O.Giroud", "S.Aguro"], | |
"LW": ["Rashford", "NeymarJr", "VinicusJr", "SonHeungMin", "JackGrealish", "S.Mane", "L.Sane", "K.Coman", "K.Kvaratskhelia", "E.Hazard", "F.Ribery", "P.Foden"], | |
"RW": ["Antony", "L.Messi", "M.Salah", "A.Robbens", "R.Mahrez", "A.DiMaria", "M.Asensio", "H.Ziyech", "L.Figo", "Garrincha", "G.Best", "G.Bale"], | |
"CM": ["Modric", "Kross", "R.Giggs", "B.Robson", "P.Scholes", "D.Beckhem", "JS.Park", "A.Herrera", "Eriksen", "B.Fernandes", "Anderson", "Powell", "S.Kagawa", "K.DeBruyne", "Guandogan", "Tiago", "VanDeBeek", "F.DeJong", "Kovacic", "Mount", "R.Neves", "A.MacAllister", "Fred", "McTomminay"], | |
"CDM": ["Casemiro", "Rodri", "DePaul", "S.Busquest", "D.Rice", "Kante", "A.Tchoumeni", "J.Kimmich", "Fabinho", "T.Partey", "E.Davids", "P.Veria", "R.Keane", "C.Makelele", "D.Deschamps", "D.Simeone", "Kheidra", "L.Matthaus", "M.Caicedo"], | |
"CB": ["Maguire", "Koulibaily", "TiagoSilva", "R.Ferdinand", "Vidic", "VanDijk", "Moore", "Matip", "KimMinJae", "Lindelof", "R.Dias", "Ake", "B.White", "Saliba", "LissandroMartinez", "R.Varane", "Deligt", "Matip", "Pique", "Marsherano", "Puyol", "Ramos", "Pepe", "E.Militao", "Alaba", "R.Arujo", "Bastoni", "Acerbi", "V.Ruiz", "Canavaro", "Upacameo", "N.Sule", "P.Jones", "Marquinhos"], | |
"LRB": ["DaniAlves", "D.Dalot", "W.Bissaka", "Trippier", "J.Cancelo", "ReeceJames", "T.AlexanderArnold", "Rafeal", "Azpilicueta", "N.Mazraoui", "WalkerPeters", "Dumfries", "JuanCuadrado", "D.Carvajal", "Pavard", "Hakimi"], | |
"GK": ["I.Casillas", "G.Buffon", "V.Valdes", "D.Degea", "J.Hart", "D.Henderson", "Pickford", "Raya", "Yashin", "Romero", "VanDerSarr", "P.Cech", "TerStegan", "M.Nuer", "Y.Sommer", "Kepa", "Donarruma", "K.Navas", "T.Coutoris", "SanchezGK", "Ramsdale", "Ederson", "Alisson", "Karius"], | |
"Manager": ["AlexFerguson", "ArsenWenger", "PepGuardiola", "CarlosAncellotti", "JoseMorinho", "LuisVanHaal", "MattBusby", "EricTenHag", "Scaloni"], | |
"Coach": ["Arteta", "FrankLampard", "DeZerbi", "GrahamPotter", "JurgenKlopp", "Pochettino", "ThomasTuchel", "DavidMoyes", "NunoSantos"], | |
"RelegationSaver": ["Shawn Dyce", "Big Sam", "RoyHodgson"] | |
} | |
# Assign players to positions | |
lineup = {} | |
for position, count in formation.items(): | |
lineup[position] = random.sample(players[position], count) | |
# Choose a captain | |
captain_position = random.choice(list(lineup.keys())) | |
captain = random.choice(lineup[captain_position]) | |
# Choose a manager | |
manager = random.choice(players["Manager"]) | |
# Print the lineup | |
print(f"{manager}'s Starting Line Up") | |
print(f"------ {lineup['ST'][0]} ------") | |
print(f"-{lineup['LW'][0]}--------{lineup['RW'][0]}-") | |
print(f"--{lineup['CM'][0]}------{lineup['CM'][1]}--") | |
print(f"------{lineup['CDM'][0]}------") | |
print(f"-{lineup['LRB'][0]}--------{lineup['LRB'][1]}-") | |
print(f"---{lineup['CB'][0]}----{lineup['CB'][1]}----{lineup['CB'][2]}----{lineup['CB'][3]}") | |
print(f"------{lineup['GK'][0]}------") | |
print(f"The main man leading the attack is {lineup['ST'][0]}") | |
print(f"and {lineup['ST'][0]} will be paired with {lineup['LW'][0]} and {lineup['RW'][0]} in wing position") | |
print(f"The midfield engine will be run by {lineup['CM'][0]}, {lineup['CM'][1]}, and {lineup['CDM'][0]}") | |
print(f"{lineup['CB'][0]}, {lineup['CB'][1]}, {lineup['CB'][2]}, and {lineup['CB'][3]} stand solid in center back position") | |
print(f"Don't forget about {lineup['LRB'][0]} and {lineup['LRB'][1]} as they are going to provide dangerous crosses to opposition box") | |
print(f"At last, {lineup['GK'][0]}'s wall of steel guards the goal") | |
print(f"and this particular team will be led by {captain} as captain") | |
print(f"Can {manager} lead this team to victory?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment