# Number guessing game

**URL:** <https://discourse.processing.org/t/number-guessing-game/39364>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [October 20, 2022, 12:25am UTC](https://discourse.processing.org/t/number-guessing-game/39364 "2022-10-20T00:25:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OutLite](https://avatars.discourse-cdn.com/v4/letter/o/ee7513/32.png) [@OutLite](https://discourse.processing.org/u/OutLite)\
**Post date:** [October 20, 2022, 12:25am UTC](https://discourse.processing.org/t/number-guessing-game/39364/1 "2022-10-20T00:25:42Z")

</div>

I’m new to processing and have an homework assignment to make a number guessing game. I have no idea where to start and i cant find anything online. Can anyone help me?

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [October 20, 2022, 12:50am UTC](https://discourse.processing.org/t/number-guessing-game/39364/2 "2022-10-20T00:50:06Z")

</div>

How would a number guessing game work? If you can plan out how you want something to work then you have a basis for writing computer code.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [October 20, 2022, 1:34am UTC](https://discourse.processing.org/t/number-guessing-game/39364/3 "2022-10-20T01:34:27Z")

</div>

Hi and welcome

This is the basic structure of the code  
You need to make random numbers say between 0-9

```auto
Int play_guess
Int play_guess = int(random(9)); //Random number generation

```

Then you need to use if and else and key pressed

> **[Reference](https://processing.org/reference/if.html)**
>
> Allows the program to make a decision about which code to execute. If the test evaluates to true, the statements enclosed within the block are executed and if the test evaluates t…

> **[Reference](https://processing.org/reference/else.html)**
>
> Extends the if structure allowing the program to choose between two or more blocks of code. It specifies a block of code to execute when the expression in if is false.

> **[Reference](https://processing.org/reference/random_.html)**
>
> Generates random numbers. Each time the random() function is called, it returns an unexpected value within the specified range. If only one parameter is passed to the function, it will return a…

> **[Reference](https://processing.org/reference/keyPressed_.html)**
>
> The keyPressed() function is called once every time a key is pressed. The key that was pressed is stored in the key variable. For non-ASCII keys, use the keyCode var…

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 21, 2022, 10:34am UTC](https://discourse.processing.org/t/number-guessing-game/39364/4 "2022-10-21T10:34:54Z")

</div>

Yeah, sorry, this is not how the forum works.

Please come up with a basic Sketch with `setup()` and `draw()` and ask specific questions.

- Make a PLAN
- write down the steps
- what do you expect to see from the program on the screen?
- Start to program the single steps that you’ve identified
- Then ask specific questions like “_how can I get a random number?_”.

Warm regards,

Chrisir
