{"id":199,"date":"2025-12-22T20:38:50","date_gmt":"2025-12-22T20:38:50","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/g_cruz\/?p=199"},"modified":"2025-12-22T20:38:50","modified_gmt":"2025-12-22T20:38:50","slug":"gambling-back-at-it","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/g_cruz\/2025\/12\/22\/gambling-back-at-it\/","title":{"rendered":"Gambling (back at it)"},"content":{"rendered":"\n<p>I&#8217;m currently trying (again) to make a game of roulette.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Need some imports...\nimport sys, random, time<\/code><\/pre>\n\n\n\n<p>These lines are the basic imports to get started, but the random module is the most important as it completely determines the pseudo-randomness.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#set up the wheel, with three zeroes to make it worse (evil)\nwheel = &#91;\n    {\"number\" : \"0\", \"color\" : \"green\"},\n    {\"number\" : \"00\", \"color\" : \"green\"},\n    {\"number\" : \"000\", \"color\" : \"green\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 3, \"color\" : \"red\"},\n    {\"number\" : 4, \"color\" : \"black\"},\n    {\"number\" : 5, \"color\" : \"red\"},\n    {\"number\" : 6, \"color\" : \"black\"},\n    {\"number\" : 7, \"color\" : \"red\"},\n    {\"number\" : 8, \"color\" : \"black\"},\n    {\"number\" : 9, \"color\" : \"red\"},\n    {\"number\" : 10, \"color\" : \"black\"},\n    {\"number\" : 11, \"color\" : \"red\"},\n    {\"number\" : 12, \"color\" : \"black\"},\n    {\"number\" : 13, \"color\" : \"red\"},\n    {\"number\" : 14, \"color\" : \"black\"},\n    {\"number\" : 15, \"color\" : \"red\"},\n    {\"number\" : 16, \"color\" : \"black\"},\n    {\"number\" : 17, \"color\" : \"red\"},\n    {\"number\" : 18, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n    {\"number\" : 1, \"color\" : \"red\"},\n    {\"number\" : 2, \"color\" : \"black\"},\n]<\/code><\/pre>\n\n\n\n<p>This massive chunk of code is simply a list of the possible things to bet on the table that you could get on the wheel.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#wheel functions\ndef spin_wheel(bettedNumList):\n    result = 0\n\n    print(\"Spinning wheel...\")\n    time.sleep(textPause * 5)\n    result = random.choice(wheel)<\/code><\/pre>\n\n\n\n<p>This function is currently WIP as it is currently unfinished, but it currently will try to take all of the bets the player made  and, likely, compare them to the result that was made by random.choice.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Variables for our fellow gambl- *Player*\nyourMoney = 1000\nwins = 0\n\n#variables for the wheel\nresult = 0\ntextPause = 1<\/code><\/pre>\n\n\n\n<p>These are self-explanatory, these are defining variables for the player and the wheel\/table.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#main\nwhile yourMoney > 0:\n    print(f\"Current total: {yourMoney}\")<\/code><\/pre>\n\n\n\n<p>Again, WIP, but it should currently print your current total of &#8220;money&#8221; whenever it is above 0.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m currently trying (again) to make a game of roulette. These lines are the basic imports to get started, but the random module is the most important as it completely determines the pseudo-randomness. This massive chunk of code is simply a list of the possible things to bet on the table that you could get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-progress"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/posts\/199\/revisions\/200"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/g_cruz\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}