{"id":121,"date":"2026-03-13T15:06:09","date_gmt":"2026-03-13T15:06:09","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/l_smith\/?p=121"},"modified":"2026-03-13T15:06:09","modified_gmt":"2026-03-13T15:06:09","slug":"nba","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/l_smith\/2026\/03\/13\/nba\/","title":{"rendered":"nba"},"content":{"rendered":"\n<p>today i added a draft a draft clock  free agency standings and  trades <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\nimport math\n\nclass Player:\n    def __init__(self, name, overall, age, position):\n        self.name = name\n        self.overall = overall\n        self.age = age\n        self.position = position\n        self.team = None\n        # Logic: Minimum $1.1M, increases by $1.5M for every point over 60 Overall\n        self.asking_salary = max(1100000, (overall - 60) * 1500000)\n\nclass Team:\n    def __init__(self, name, budget):\n        self.name = name\n        self.budget = budget\n        self.roster = &#91;]\n\n    def can_afford(self, salary):\n        return self.budget >= salary\n\n    def sign_player(self, player):\n        if self.can_afford(player.asking_salary):\n            self.budget -= player.asking_salary\n            player.team = self.name\n            self.roster.append(player)\n            return True\n        return False\n\n# 1. Setup Sample Data\nplayers = &#91;\n    Player(\"Luka Magic\", 97, 25, \"PG\"),\n    Player(\"Big Ticket\", 90, 28, \"C\"),\n    Player(\"3-Point King\", 88, 32, \"SG\"),\n    Player(\"Rookie Star\", 78, 20, \"SF\"),\n    Player(\"Vet Min\", 72, 35, \"PF\")\n]\n\nteams = &#91;\n    Team(\"Lakers\", 50_000_000),\n    Team(\"Knicks\", 45_000_000),\n    Team(\"Spurs\", 65_000_000)\n]\n\n# 2. Simulation Logic\ndef simulate_free_agency(player_list, team_list):\n    # Sort by overall so stars sign first\n    player_list.sort(key=lambda x: x.overall, reverse=True)\n    \n    for player in player_list:\n        # Find teams that can afford the player\n        suitors = &#91;t for t in team_list if t.can_afford(player.asking_salary)]\n        \n        if suitors:\n            # Player chooses the team with the most cap space (simplified interest)\n            best_offer_team = max(suitors, key=lambda t: t.budget)\n            if best_offer_team.sign_player(player):\n                print(f\"\u2705 {player.name} ({player.overall} OVR) signed with {best_offer_team.name} for ${player.asking_salary:,}\")\n        else:\n            print(f\"\u274c {player.name} remains a Free Agent (Asking price: ${player.asking_salary:,})\")\n\n# Run the sim\nsimulate_free_agency(players, teams)\n<\/code><\/pre>\n\n\n\n<p>this will commed after the draft and if a team signs a big player like say if \u00a0<mark>LeBron James<\/mark> signs with the cavs it will say the detalls for example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"130\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-1.png\" alt=\"\" class=\"wp-image-122\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-1.png 456w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-1-300x86.png 300w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/figure>\n\n\n\n<p>as u can see this is after 1 year simulation and how Luka signed with spuers for 55,500,000 (witch is a lot of money) (in my option) but it will show u the big offseason moves <\/p>\n\n\n\n<p>it shows the actual games <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"473\" height=\"189\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-2.png\" alt=\"\" class=\"wp-image-123\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-2.png 473w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-2-300x120.png 300w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/figure>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>today i added a draft a draft clock free agency standings and trades this will commed after the draft and if a team signs a big player like say if \u00a0LeBron James signs with the cavs it will say the detalls for example: as u can see this is after 1 year simulation and how [&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-121","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/121","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=121"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/121\/revisions\/124"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}