{"id":116,"date":"2026-03-06T15:10:27","date_gmt":"2026-03-06T15:10:27","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/l_smith\/?p=116"},"modified":"2026-03-11T15:13:30","modified_gmt":"2026-03-11T15:13:30","slug":"nba-style-predictor","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/l_smith\/2026\/03\/06\/nba-style-predictor\/","title":{"rendered":"NBA style predictor"},"content":{"rendered":"\n<p>today im taking a brake from my wheelchair basketball game and making a nba style of my nfl projct from a few months ago and since i wrote almost all the code already i just mostly copyed and pasted the code<\/p>\n\n\n\n<p>this vision with have box score 82 games for EACH team playoffs sats and more  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\n\nclass NBAGame:\n    def __init__(self, home_team, away_team):\n        self.home_team = home_team\n        self.away_team = away_team\n        # Dictionary to store the points per quarter\n        self.box_score = {\n            \"Home\": {\"Q1\": 0, \"Q2\": 0, \"Q3\": 0, \"Q4\": 0, \"OT\": 0, \"Total\": 0},\n            \"Away\": {\"Q1\": 0, \"Q2\": 0, \"Q3\": 0, \"Q4\": 0, \"OT\": 0, \"Total\": 0}\n        }\n\n    def simulate_quarter(self, q_name):\n        # NBA teams usually score 22-35 points per quarter\n        h_pts = random.randint(22, 36)\n        a_pts = random.randint(22, 36)\n        \n        self.box_score&#91;\"Home\"]&#91;q_name] = h_pts\n        self.box_score&#91;\"Away\"]&#91;q_name] = a_pts\n        self.box_score&#91;\"Home\"]&#91;\"Total\"] += h_pts\n        self.box_score&#91;\"Away\"]&#91;\"Total\"] += a_pts\n\n    def play_game(self):\n        # Play the standard 4 quarters\n        for q in &#91;\"Q1\", \"Q2\", \"Q3\", \"Q4\"]:\n            self.simulate_quarter(q)\n\n        # Overtime logic (NBA games cannot end in a tie)\n        while self.box_score&#91;\"Home\"]&#91;\"Total\"] == self.box_score&#91;\"Away\"]&#91;\"Total\"]:\n            print(\"--- OVERTIME! ---\")\n            h_ot = random.randint(5, 15)\n            a_ot = random.randint(5, 15)\n            self.box_score&#91;\"Home\"]&#91;\"OT\"] += h_ot\n            self.box_score&#91;\"Away\"]&#91;\"OT\"] += a_ot\n            self.box_score&#91;\"Home\"]&#91;\"Total\"] += h_ot\n            self.box_score&#91;\"Away\"]&#91;\"Total\"] += a_ot\n\n        self.display_box_score()\n        return self.home_team if self.box_score&#91;\"Home\"]&#91;\"Total\"] &gt; self.box_score&#91;\"Away\"]&#91;\"Total\"] else self.away_team\n\n    def display_box_score(self):\n        h = self.box_score&#91;\"Home\"]\n        a = self.box_score&#91;\"Away\"]\n        \n        print(f\"\\n{'TEAM':&lt;10} | Q1 | Q2 | Q3 | Q4 | OT | FINAL\")\n        print(\"-\" * 45)\n        print(f\"{self.away_team:&lt;10} | {a&#91;'Q1']:&gt;2} | {a&#91;'Q2']:&gt;2} | {a&#91;'Q3']:&gt;2} | {a&#91;'Q4']:&gt;2} | {a&#91;'OT']:&gt;2} | {a&#91;'Total']}\")\n        print(f\"{self.home_team:&lt;10} | {h&#91;'Q1']:&gt;2} | {h&#91;'Q2']:&gt;2} | {h&#91;'Q3']:&gt;2} | {h&#91;'Q4']:&gt;2} | {h&#91;'OT']:&gt;2} | {h&#91;'Total']}\")\n        \n        winner = self.home_team if h&#91;'Total'] &gt; a&#91;'Total'] else self.away_team\n        print(f\"\\nWINNER: {winner}\\n\")<\/code><\/pre>\n\n\n\n<p>i hoping to add trades FA (&nbsp;<mark><strong>Free Agency<\/strong><\/mark>. ) AND MORE<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"944\" height=\"612\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image.png\" alt=\"\" class=\"wp-image-118\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image.png 944w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-300x194.png 300w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2026\/03\/image-768x498.png 768w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>today im taking a brake from my wheelchair basketball game and making a nba style of my nfl projct from a few months ago and since i wrote almost all the code already i just mostly copyed and pasted the code this vision with have box score 82 games for EACH team playoffs sats and [&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-116","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/116","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=116"}],"version-history":[{"count":2,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/116\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}