{"id":125,"date":"2026-03-24T14:08:32","date_gmt":"2026-03-24T14:08:32","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/l_smith\/?p=125"},"modified":"2026-03-24T14:08:32","modified_gmt":"2026-03-24T14:08:32","slug":"nba-sim","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/l_smith\/2026\/03\/24\/nba-sim\/","title":{"rendered":"nba sim"},"content":{"rendered":"\n<p>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 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class free_agents_pool:\n nba_free_agents_2026 = &#91;\n    {\"player\": \"LeBron James\", \"position\": \"SF\/PF\", \"team\": \"Los Angeles Lakers\", \"status\": \"UFA\"},\n    {\"player\": \"Luka Doncic\", \"position\": \"PG\", \"team\": \"Los Angeles Lakers\", \"status\": \"Player Option\"},\n    {\"player\": \"Kevin Durant\", \"position\": \"SF\", \"team\": \"Houston Rockets\", \"status\": \"UFA\"},\n    {\"player\": \"Trae Young\", \"position\": \"PG\", \"team\": \"Atlanta Hawks\", \"status\": \"Player Option\"},\n    {\"player\": \"De'Aaron Fox\", \"position\": \"PG\", \"team\": \"San Antonio Spurs\", \"status\": \"UFA\"},\n    {\"player\": \"James Harden\", \"position\": \"PG\/SG\", \"team\": \"Cleveland Cavaliers\", \"status\": \"Player Option\"},\n    {\"player\": \"Zach LaVine\", \"position\": \"SG\/SF\", \"team\": \"Sacramento Kings\", \"status\": \"Player Option\"},\n    {\"player\": \"Mikal Bridges\", \"position\": \"SF\", \"team\": \"New York Knicks\", \"status\": \"UFA\"},\n    {\"player\": \"Kristaps Porzi\u0146\u0123is\", \"position\": \"C\/PF\", \"team\": \"Golden State Warriors\", \"status\": \"UFA\"},\n    {\"player\": \"Nikola Vu\u010devi\u0107\", \"position\": \"C\", \"team\": \"Boston Celtics\", \"status\": \"UFA\"},\n    {\"player\": \"CJ McCollum\", \"position\": \"SG\/PG\", \"team\": \"Atlanta Hawks\", \"status\": \"UFA\"},\n    {\"player\": \"Norman Powell\", \"position\": \"SG\", \"team\": \"Miami Heat\", \"status\": \"UFA\"},\n    {\"player\": \"Austin Reaves\", \"position\": \"SG\", \"team\": \"Los Angeles Lakers\", \"status\": \"Player Option\"},\n    {\"player\": \"Isaiah Hartenstein\", \"position\": \"C\/PF\", \"team\": \"Oklahoma City Thunder\", \"status\": \"Team Option\"},\n    {\"player\": \"Coby White\", \"position\": \"PG\/SG\", \"team\": \"Charlotte Hornets\", \"status\": \"UFA\"},\n    {\"player\": \"John Collins\", \"position\": \"PF\", \"team\": \"Los Angeles Clippers\", \"status\": \"UFA\"},\n    {\"player\": \"Tobias Harris\", \"position\": \"PF\/SF\", \"team\": \"Detroit Pistons\", \"status\": \"UFA\"}\n]<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> \"Golden State Warriors\": 11.33,\n    \"New York Knicks\": 10.1,\n    \"Los Angeles Lakers\": 10.0,\n    \"Boston Celtics\": 7.5,\n    \"Los Angeles Clippers\": 6.0,\n    \"Chicago Bulls\": 5.8,\n    \"Miami Heat\": 5.5,\n    \"Philadelphia 76ers\": 5.4,\n    \"Toronto Raptors\": 5.2,\n    \"Houston Rockets\": 5.1,\n    \"Dallas Mavericks\": 5.0,\n    \"Brooklyn Nets\": 4.9,\n    \"Phoenix Suns\": 4.8,\n    \"Washington Wizards\": 4.5,\n    \"Milwaukee Bucks\": 4.4,\n    \"Portland Trail Blazers\": 4.35,\n    \"Sacramento Kings\": 4.3,\n    \"Atlanta Hawks\": 4.25,\n    \"Utah Jazz\": 4.2,\n    \"Denver Nuggets\": 4.15,\n    \"San Antonio Spurs\": 4.1,\n    \"Orlando Magic\": 4.05,\n    \"Detroit Pistons\": 4.04,\n    \"Oklahoma City Thunder\": 4.03,\n    \"Minnesota Timberwolves\": 4.02,\n    \"Cleveland Cavaliers\": 4.01,\n    \"Charlotte Hornets\": 4.005,\n    \"Indiana Pacers\": 4.002,\n    \"New Orleans Pelicans\": 4.001,\n    \"Memphis Grizzlies\": 4.0<\/code><\/pre>\n\n\n\n<p>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 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> while game_num &lt;= 7:\n        print(f\"\\n--- Game {game_num} ---\")\n        \n\ndef simulate_series(team1, team2):\n    t1_wins = 0\n    t2_wins = 0\n    game = 1\n    \n    while t1_wins &lt; 4 and t2_wins &lt; 4:\n        # Simple simulation: random score between 95 and 125\n        t1_score = random.randint(95, 125)\n        t2_score = random.randint(95, 125)\n        \n        if t1_score > t2_score:\n            t1_wins += 1\n            print(f\"Game {game}: {team1} wins ({t1_score}-{t2_score})\")\n        else:\n            t2_wins += 1\n            print(f\"Game {game}: {team2} wins ({t2_score}-{t1_score})\")\n        game += 1\n        \n    print(f\"Series Final: {t1_wins}-{t2_wins}\")\n<\/code><\/pre>\n\n\n\n<p>now has we all know the nba has a 7 game sries or frist team to win 4 games so for example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 1, Jun 2<\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">89<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606020GSW.html\">Final<\/a><\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">104<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/i\/irvinky01.html\">K. Irving<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">26<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/l\/loveke01.html\">K. Love<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">13<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 2, Jun 5<\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">77<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606050GSW.html\">Final<\/a><\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">110<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/g\/greendr01.html\">D. Green<\/a>-GSW<\/td><td class=\"has-text-align-right\" data-align=\"right\">28<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/c\/curryst01.html\">S. Curry<\/a>-GSW<\/td><td class=\"has-text-align-right\" data-align=\"right\">9<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 3, Jun 8<\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">90<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606080CLE.html\">Final<\/a><\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">120<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/j\/jamesle01.html\">L. James<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">32<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/t\/thomptr01.html\">T. Thompson<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">13<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 4, Jun 10<\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">108<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606100CLE.html\">Final<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">97<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/c\/curryst01.html\">S. Curry<\/a>-GSW<\/td><td class=\"has-text-align-right\" data-align=\"right\">38<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/j\/jamesle01.html\">L. James<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">13<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 5, Jun 13<\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">112<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606130GSW.html\">Final<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">97<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td>2 tied<\/td><td class=\"has-text-align-right\" data-align=\"right\">41<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/j\/jamesle01.html\">L. James<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">16<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 6, Jun 16<\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">101<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606160CLE.html\">Final<\/a><\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">115<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/j\/jamesle01.html\">L. James<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">41<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/t\/thomptr01.html\">T. Thompson<\/a>-CLE<\/td><td class=\"has-text-align-right\" data-align=\"right\">16<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\" colspan=\"3\">Game 7, Jun 19<\/td><\/tr><tr><td><strong><a href=\"https:\/\/www.basketball-reference.com\/teams\/CLE\/2016.html\">Cleveland Cavaliers<\/a><\/strong><\/td><td class=\"has-text-align-right\" data-align=\"right\">93<\/td><td class=\"has-text-align-right\" data-align=\"right\"><a href=\"https:\/\/www.basketball-reference.com\/boxscores\/201606190GSW.html\">Final<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.basketball-reference.com\/teams\/GSW\/2016.html\">Golden State Warriors<\/a><\/td><td class=\"has-text-align-right\" data-align=\"right\">89<\/td><td class=\"has-text-align-right\" data-align=\"right\">&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>PTS<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/g\/greendr01.html\">D. Green<\/a>-GSW<\/td><td class=\"has-text-align-right\" data-align=\"right\">32<\/td><\/tr><tr><td><strong>TRB<\/strong><\/td><td><a href=\"https:\/\/www.basketball-reference.com\/players\/g\/greendr01.html\">D. Green<\/a>-GSW<\/td><td class=\"has-text-align-right\" data-align=\"right\">15<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>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 <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"552\" height=\"309\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-3.png\" alt=\"\" class=\"wp-image-126\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-3.png 552w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-3-300x168.png 300w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"294\" height=\"472\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-4.png\" alt=\"\" class=\"wp-image-127\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-4.png 294w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-4-187x300.png 187w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"539\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-5.png\" alt=\"\" class=\"wp-image-128\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-5.png 930w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-5-300x174.png 300w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-5-768x445.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>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 the conracts will all be random for example james harden lets say he signed with the bulls for 5 years for oh [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"predecessor-version":[{"id":129,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/125\/revisions\/129"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}