nba sim


sorry about not posting last friday my website was down but it working now so anyway i fixed the free agency logic and i added a playoffs file i added each team buget

class free_agents_pool:
 nba_free_agents_2026 = [
    {"player": "LeBron James", "position": "SF/PF", "team": "Los Angeles Lakers", "status": "UFA"},
    {"player": "Luka Doncic", "position": "PG", "team": "Los Angeles Lakers", "status": "Player Option"},
    {"player": "Kevin Durant", "position": "SF", "team": "Houston Rockets", "status": "UFA"},
    {"player": "Trae Young", "position": "PG", "team": "Atlanta Hawks", "status": "Player Option"},
    {"player": "De'Aaron Fox", "position": "PG", "team": "San Antonio Spurs", "status": "UFA"},
    {"player": "James Harden", "position": "PG/SG", "team": "Cleveland Cavaliers", "status": "Player Option"},
    {"player": "Zach LaVine", "position": "SG/SF", "team": "Sacramento Kings", "status": "Player Option"},
    {"player": "Mikal Bridges", "position": "SF", "team": "New York Knicks", "status": "UFA"},
    {"player": "Kristaps Porziņģis", "position": "C/PF", "team": "Golden State Warriors", "status": "UFA"},
    {"player": "Nikola Vučević", "position": "C", "team": "Boston Celtics", "status": "UFA"},
    {"player": "CJ McCollum", "position": "SG/PG", "team": "Atlanta Hawks", "status": "UFA"},
    {"player": "Norman Powell", "position": "SG", "team": "Miami Heat", "status": "UFA"},
    {"player": "Austin Reaves", "position": "SG", "team": "Los Angeles Lakers", "status": "Player Option"},
    {"player": "Isaiah Hartenstein", "position": "C/PF", "team": "Oklahoma City Thunder", "status": "Team Option"},
    {"player": "Coby White", "position": "PG/SG", "team": "Charlotte Hornets", "status": "UFA"},
    {"player": "John Collins", "position": "PF", "team": "Los Angeles Clippers", "status": "UFA"},
    {"player": "Tobias Harris", "position": "PF/SF", "team": "Detroit Pistons", "status": "UFA"}
]
 "Golden State Warriors": 11.33,
    "New York Knicks": 10.1,
    "Los Angeles Lakers": 10.0,
    "Boston Celtics": 7.5,
    "Los Angeles Clippers": 6.0,
    "Chicago Bulls": 5.8,
    "Miami Heat": 5.5,
    "Philadelphia 76ers": 5.4,
    "Toronto Raptors": 5.2,
    "Houston Rockets": 5.1,
    "Dallas Mavericks": 5.0,
    "Brooklyn Nets": 4.9,
    "Phoenix Suns": 4.8,
    "Washington Wizards": 4.5,
    "Milwaukee Bucks": 4.4,
    "Portland Trail Blazers": 4.35,
    "Sacramento Kings": 4.3,
    "Atlanta Hawks": 4.25,
    "Utah Jazz": 4.2,
    "Denver Nuggets": 4.15,
    "San Antonio Spurs": 4.1,
    "Orlando Magic": 4.05,
    "Detroit Pistons": 4.04,
    "Oklahoma City Thunder": 4.03,
    "Minnesota Timberwolves": 4.02,
    "Cleveland Cavaliers": 4.01,
    "Charlotte Hornets": 4.005,
    "Indiana Pacers": 4.002,
    "New Orleans Pelicans": 4.001,
    "Memphis Grizzlies": 4.0

the conracts will all be random for example james harden lets say he signed with the bulls for 5 years for oh i dont know 24.6 millon then the code would print james harden has signed a 5 year $24.6 millon deal with Chicago Bulls

 while game_num <= 7:
        print(f"\n--- Game {game_num} ---")
        

def simulate_series(team1, team2):
    t1_wins = 0
    t2_wins = 0
    game = 1
    
    while t1_wins < 4 and t2_wins < 4:
        # Simple simulation: random score between 95 and 125
        t1_score = random.randint(95, 125)
        t2_score = random.randint(95, 125)
        
        if t1_score > t2_score:
            t1_wins += 1
            print(f"Game {game}: {team1} wins ({t1_score}-{t2_score})")
        else:
            t2_wins += 1
            print(f"Game {game}: {team2} wins ({t2_score}-{t1_score})")
        game += 1
        
    print(f"Series Final: {t1_wins}-{t2_wins}")

now has we all know the nba has a 7 game sries or frist team to win 4 games so for example:

Game 1, Jun 2
Cleveland Cavaliers89Final
Golden State Warriors104 
PTSK. Irving-CLE26
TRBK. Love-CLE13
Game 2, Jun 5
Cleveland Cavaliers77Final
Golden State Warriors110 
PTSD. Green-GSW28
TRBS. Curry-GSW9
Game 3, Jun 8
Golden State Warriors90Final
Cleveland Cavaliers120 
PTSL. James-CLE32
TRBT. Thompson-CLE13
Game 4, Jun 10
Golden State Warriors108Final
Cleveland Cavaliers97 
PTSS. Curry-GSW38
TRBL. James-CLE13
Game 5, Jun 13
Cleveland Cavaliers112Final
Golden State Warriors97 
PTS2 tied41
TRBL. James-CLE16
Game 6, Jun 16
Golden State Warriors101Final
Cleveland Cavaliers115 
PTSL. James-CLE41
TRBT. Thompson-CLE16
Game 7, Jun 19
Cleveland Cavaliers93Final
Golden State Warriors89 
PTSD. Green-GSW32
TRBD. Green-GSW15

has u can see from this example where CLEVLAND beat golden state 4 games to 3 (the full 7 games) this the code will do the same but everytime it will be diffent and you the user can import your own score so just as a exmaple LAL (lakers) and CLE(CAVS) lets say game 1 in LA 99-74 LA WINS 1-0 THEN GAME 2 IN LA 110-97 LA WINS GAME 3 IN CLEVLAND 117-114 CLE WINS GAME 4 IN CLEVLAND 135-140 LAL WINS AT THAT POINT IT WOULD BE 3-1 LAL LEADS SRIES


2 responses to “nba sim”

Leave a Reply

Your email address will not be published. Required fields are marked *