Coding Stuff


September 21st, 2025 Coding project #1 The Number game!
During the past week I’ve been working on a piece of code with the goal of demonstrating a basic understanding and way to use simple coding statements. Throughout this process I’ve had success, failure, and road blocks but in the end produced a piece of code I’m proud of. I used assistance from google gemini in the creation of my project and a link to my chat in a google doc is just below.
https://docs.google.com/document/d/1c7dUjtHHSlJs8PB8FRADFDpH2eKm8l9Qf-JZ_EcIUOI/edit?usp=sharing
I chose to create a number guessing game in which the player would guess a number 1-10 and would be told whether the number was higher or lower than their guess. I executed my idea without any problems in which I found it quite amusing however for a source of entertainment it lacked complexity and became boring quick. I then added a guess counter, and a guess limit while keeping the thought of adding more ways to play in mind. I took the boldest move yet and made an attempt at creating multiple game modes. I first created a hard mode and added different winning lines and after learning it was quite simple I easily made a pro mode. In the end my code reflected a great use of the basic coding statements and accomplished its goal of being a fun entertaining game.
I also created a flow chart to outline the process when tackling a coding problem. The image is below!

Below is an in depth analysis of my code provided through this link
https://colab.research.google.com/drive/1e2GC64BxgIyrPGTSjk7-cj3tSXUu_Agr?usp=sharing

The first block of code goes over my number generation set being “import random”, printed text to open out the game, the ability to chose different modes that affect guesses and number ranges. While true allows us to create a loop for our code continuing to the end. The print line is a basic coding idea in which you type print and it projects text that you put inside the brackets. Below is an if statement and elif statement and an else statement which basically means if you type h run that code, if you type p run that code, and lastly if neither of the others it will run that code. The values below the if/else statements are the guess you get and the number range in which connect to the guessing portion of the code and the number range that is generated.

In this code block in includes the end of the first part showing the text that will be printed if mode = easy and also the higher or lower, and number generator. Line 2-4 work together to generator a random number between 1 and the number range of either 10, 100, or 1000 depending on your mode. line 5 goes over how if guesses used is less than total guesses the game will continue. The next few lines go over how the guess must = an integer for the request on later lines to be processed and that guess used goes up by one each time. Another if statement is used how if the guess equals the generated number than it will go down below and print the winning text but if it is not the secret number being lower or higher the respective texts will be written. Lastly if the guesses left are less than your total guesses than the request to print how many guesses you have left is run.

To start off the last portion of code it covers if not whole numbers and used as an answer, the winning lines for each respective role, losing lines, what the number was, and if you want to play again. If the value is not an error connecting to the previous line then line 2 in this section is printed. If the mode at the start was pro than an original line would be printed with the same for other modes. The else statement below shows that if the number is not guessed that 2 lines will be printed with the second listing the randomly generated number. Lastly an input is asked from the player for whether they want to play again and if the play again input equals yes the game restarts and if it doesn’t represented by the != sign than the text on the last line is printed before the play through ends.

Thank you for taking time out of your day to read my blog post on my coding project, don’t worry if your keen on reading
More blog posts are coming soon!

Comments

2 Responses to “Coding Stuff”

  1. A WordPress Commenter Avatar

    Hi, this is a comment.
    To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
    Commenter avatars come from Gravatar.

  2. mcrompton Avatar
    mcrompton

    OK, Will. This is a good start! I’m assuming that your knowledge of coding prior to this assignment was pretty low. You have used an interesting approach in asking Gemini for code snippits and for an explanation of what they do. This is a good way for a beginner to learn the language. I have a couple of suggestions for future work. Your flowchart is intended to be a map of the flow of logic for your program. You have used it to describe your approach to completing the assignment. Flowcharting is an excellent tool to figure out what path the code will take prior to coding the program. You’ve also used the definition of a function in an interesting, but ineffective way. Functions can be thought of snippets of code that will get used repeatedly in a program. Rather than rewriting the same code each time you need it, you simply call the pre-defined function. By defining the entire program as a function, you only have the opportunity to call it once. A good function would be called multiple times within the full program. Things to think about for your next coding project.

Leave a Reply to A WordPress Commenter Cancel reply

Your email address will not be published. Required fields are marked *