{"id":44,"date":"2024-10-15T11:57:05","date_gmt":"2024-10-15T15:57:05","guid":{"rendered":"https:\/\/wp.stgeorges.bc.ca\/josht\/?p=44"},"modified":"2024-10-15T11:57:05","modified_gmt":"2024-10-15T15:57:05","slug":"coding-project","status":"publish","type":"post","link":"https:\/\/wp.stgeorges.bc.ca\/josht\/2024\/10\/15\/coding-project\/","title":{"rendered":"Coding Project"},"content":{"rendered":"\n<p>For my coding project, I decided to make somewhat of a joke. I decided to code a program that allows the user to input a number, claiming to be able to read the user&#8217;s mind, when in reality, it&#8217;s just repeating the inputted number.<\/p>\n\n\n\n<p><a href=\"https:\/\/replit.com\/join\/qdbcrtimey-joshtsaiii\">Link to code<\/a><\/p>\n\n\n\n<p>Flowchart:<\/p>\n\n\n\n<p>1. Asks user to input a number<\/p>\n\n\n\n<p>2. Pretends to think while displaying lines like &#8220;reading brainwaves&#8221;<\/p>\n\n\n\n<p>3. &#8220;Guesses&#8221; the number by repeating whatever the user input<\/p>\n\n\n\n<p>4. Asks if it was correct, and allows user to play again.<\/p>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"114\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085331831.png\" alt=\"\" class=\"wp-image-56 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085331831.png 657w, https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085331831-300x52.png 300w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>First, I imported &#8220;time&#8221; and &#8220;random&#8221; in order to be able to create delays in between messages, as well as pick random lines, which will be demonstrated shortly.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"139\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085350931.png\" alt=\"\" class=\"wp-image-57 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085350931.png 601w, https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image_2024-10-15_085350931-300x69.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>Next, I created the function &#8220;read_mind&#8221;, and added a short description.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"967\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-11.png\" alt=\"\" class=\"wp-image-48 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-11.png 455w, https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-11-141x300.png 141w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>This monstrosity of code was just my lazy attempt at making the program&#8217;s responses random. I didn&#8217;t want to figure out how to use %s and the like, so I just repeated each line a different amount of times, so that I could have rare lines like &#8220;Super rare message.&#8221;<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"388\" height=\"102\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-12.png\" alt=\"\" class=\"wp-image-49 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-12.png 388w, https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-12-300x79.png 300w\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>This picks 3 lines from the line bank to display during the &#8220;loading&#8221; process.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"294\" height=\"94\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-13.png\" alt=\"\" class=\"wp-image-50 size-full\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>This line is where all the magic happens, as the program repeats the inputted number to you, successfully reading your mind.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"270\" src=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-14.png\" alt=\"\" class=\"wp-image-51 size-full\" srcset=\"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-14.png 413w, https:\/\/wp.stgeorges.bc.ca\/josht\/wp-content\/uploads\/sites\/15\/2024\/10\/image-14-300x196.png 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>Finally, this whimsically asks the user whether or not it was right, even though it already knows. It concludes by asking the user if they would like to play again.<\/p>\n<\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For my coding project, I decided to make somewhat of a joke. I decided to code a program that allows the user to input a number, claiming to be able to read the user&#8217;s mind, when in reality, it&#8217;s just repeating the inputted number. Link to code Flowchart: 1. Asks user to input a number [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-demonstrating"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":2,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":58,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/posts\/44\/revisions\/58"}],"wp:attachment":[{"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.stgeorges.bc.ca\/josht\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}