{"id":70,"date":"2025-12-05T16:16:05","date_gmt":"2025-12-05T16:16:05","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/l_smith\/?p=70"},"modified":"2025-12-05T16:26:51","modified_gmt":"2025-12-05T16:26:51","slug":"hp-based-game-stage-1-day-2","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/l_smith\/2025\/12\/05\/hp-based-game-stage-1-day-2\/","title":{"rendered":"HP based game stage 1 day 2"},"content":{"rendered":"\n<p>alright well i got a hole lot done today <\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/LarrySmith8209\/harry-potter\/tree\/main\/stage%201\">https:\/\/github.com\/LarrySmith8209\/harry-potter\/tree\/main\/stage%201<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/docs.google.com\/document\/d\/1BL5QrtWzxPMgtxUprEPQTWSab60QFM5qK0edP2zHVJY\/edit?tab=t.0\">https:\/\/docs.google.com\/document\/d\/1BL5QrtWzxPMgtxUprEPQTWSab60QFM5qK0edP2zHVJY\/edit?tab=t.0<\/a><\/p>\n\n\n\n<p>this will bring you to all the code so far <\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\nfrom houses import house \nfrom  standings import standings   \n\n# Initialize scores using a dictionary\nhouse_points = {\n    \"phoehix\": 0,\n    \"thunderbird\": 0,\n    \"dragon\": 0,\n    \"wolf\": 0\n}\n\ndef update_score(house_name, points):\n    \"\"\"Increments or decrements the score of a specific house.\"\"\"\n    if house_name in house_points:\n        house_points&#91;house_name] += points\n        action = \"gained\" if points &gt; 0 else \"lost\"\n        print(f\"{house_name} has {action} {abs(points)} points.\")\n    else:\n        print(f\"Error: {house_name} is not a valid house.\")\n\ndef display_scores():\n    \"\"\"Prints the current scores for all houses, sorted from highest to lowest.\"\"\"\n    print(\"\\n--- Current House Scores ---\")\n    # Sort the dictionary items by score in descending order\n    sorted_scores = sorted(house_points.items(), key=lambda item: item&#91;1], reverse=True)\n    for house, score in sorted_scores:\n        print(f\"{house}: {score}\")\n\n\nupdate_score(\"phoehix\",())\nupdate_score={\"thunderbird\",()}\nupdate_score(\"dragon\",{})\nupdate_score(\"wolf\",{})\n\ndisplay_scores()\nprint(house_points)\n\nclass housecup:\n    def winner(self):\n        highest_score = max(house_points.values())\n        winners = &#91;house for house, score in house_points.items() if score == highest_score]\n        if len(winners) == 1:\n            return f\"The winner of the House Cup is {winners&#91;0]} with {highest_score} points!\"\n        else:\n            return f\"It's a tie between {' and '.join(winners)} with {highest_score} points each!\"\n        if tie in winners:\n            return \"It's a tie! A special competition will be held to determine the ultimate winner!\"\nhouse_cup = housecup()\nprint(house_cup.standings())\n\nprint(house_cup.winner())\nclass standings:\n    def display_standings(self):\n        sorted_scores = sorted(house_points.items(), key=lambda item: item&#91;1], reverse=True)\n        print(\"\\n--- House Cup Standings ---\")\n        for rank, (house, score) in enumerate(sorted_scores, start=1):\n            print(f\"{rank}. {house}: {score} points\")\nstandings = standings()\nstandings.display_standings()\nprint(house_points)\n<\/code><\/pre>\n\n\n\n<p>this is for the house cup <\/p>\n\n\n\n<p>the house cup will be aworded at the end of each year <\/p>\n\n\n\n<p>this is for the standings of the house cup<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import random\nfrom housecup import house_points\nclass standings:\n    def display_standings(self):\n        sorted_scores = sorted(house_points.items(), key=lambda item: item&#91;1], reverse=True)\n        print(\"\\n--- House Cup Standings ---\")\n        for rank, (house, score) in enumerate(sorted_scores, start=1):\n            print(f\"{rank}. {house}: {score} points\")\nstandings = standings()\nstandings.display_standings()\nprint(house_points)\n\n\n\nclass gethouse_points:\n      for house, points in house_points.items():\n          print(f\"{house}: {points} points\")\n          def get_points(self, house_name):\n              return house_points.get(house_name, 0)\n            \n              class tie_breaker:\n                  def tie_qustion(self):\n                   return \"Tie breaker question\"\n          tie_breaker = tie_breaker()\n          tie_breaker.tie_qustion=random.choice(house_points)\n          playersinput= input(\"Enter the names of the players involved in the tie\") \n          print(\"the winner of the tie breaker is and therefore the house cup winner is with a final points score of\") (house_points+ random.points) (\"is\") (house) <\/code><\/pre>\n\n\n\n<p>next week i will add on to these to more houses for a total of 6 <\/p>\n\n\n\n<p>let me say this game is <strong>HARRY POTTER BASED!!!!!!!!!!!!!!!!!!!!!!!<\/strong> so im not using hogwarts houses teacher ect.) <\/p>\n\n\n\n<p>i want to thank the person who gave me the idea for this game my dad so thank you dad <\/p>\n\n\n\n<p>anyway i&#8217;ll be back next week with more info  <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"871\" height=\"685\" src=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2025\/12\/image.png\" alt=\"\" class=\"wp-image-72\" srcset=\"https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2025\/12\/image.png 871w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2025\/12\/image-300x236.png 300w, https:\/\/theroyalscode.com\/students\/l_smith\/wp-content\/uploads\/2025\/12\/image-768x604.png 768w\" sizes=\"auto, (max-width: 871px) 100vw, 871px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>alright well i got a hole lot done today https:\/\/github.com\/LarrySmith8209\/harry-potter\/tree\/main\/stage%201 https:\/\/docs.google.com\/document\/d\/1BL5QrtWzxPMgtxUprEPQTWSab60QFM5qK0edP2zHVJY\/edit?tab=t.0 this will bring you to all the code so far this is for the house cup the house cup will be aworded at the end of each year this is for the standings of the house cup next week i will add on to [&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-70","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/70","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=70"}],"version-history":[{"count":2,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/posts\/70\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/l_smith\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}