C7, 1. Guess My Number is a quick, fun, and easy opening game to lead with a small group or the entire class. Kids can immediately start playing, and have a great time doing it. The game is also a perfect way to introduce the basics of logical thought and strategy, and let the game do the teaching with only minimal extra observations from the teacher.
Surprisingly repayable and enjoyable, this is a great game to play early and often. As you write the numbers from 1 to 10 down on the board, tell your students that you are going to think of a number from 1 to 10, and they will try to guess it in the fewest number of guesses possible.
After every guess, you will tell them whether your number is greater or less than their guess. Teacher: Who would like to make the first guess? The teacher calls on different students for each guess. Teacher: My number is not 3. But my number sql int to hex without 0x greater than 3.
Teacher: Right. Because my number is greater than 3, but those numbers are less than 3 [Teacher crosses off 1 and 2. Teacher: My number is not 9, but my number is less than 9. Looks at the board. Take a minute to think about what would be a good next number to guess. Then tell someone sitting next to you what you would guess next, and why. What numbers can I cross off? Who has another guess? Teacher: My number is not 5, but it is… greater than 5. Teacher: You got it! Now that took you [counts] 1, 2, 3, 4, 5 guesses.
Who thinks they could do it in fewer? The Central Question: What is the most effective strategy to guess the number fastest? Get tons of free content, like our Games to Play at Home packet, puzzles, lessons, and more!
Description Author:. Fri, March 13,last modified October 2, AdditionCountingDivisibilityMultiplication. About This Lesson. The Launch. Student: 9.Note: You'll need to know about for loops and if statements for this guessing game, so you'll need to have read all but the last of the beginner tutorials or already know all of these concepts. In this guessing game, the computer will come up with a random number between 1 and The player must then continue to guess numbers until the player guesses the correct number.
For every guess, the computer will either say "Too high" or "Too low", and then ask for another input. At the end of the game, the number is revealed along with the number of guesses it took to get the correct number.
Ready to follow along to create this guessing game? All right. First, we're going to start by creating a new class, or Java file. Call your new program GuessingGame, keeping the capitalization the same. If you're using Eclipse and I strongly urge you to! You should start out like this:. Ok, we need the computer to generate random numbers. Just add this code inside your main method so you have this:. Don't worry much about how Random works.
All you need to know for this guessing game is that the variable numberToGuess holds the integer that the player has to guess. Notice you'll get an error when you try to use Random. This is the same problem that Scanner has. All you have to do is right-click your work area, go to source, and select Organize Imports.
This will take care of the problem for you. If you want to just import manually, type in import java. Random; at the very top of the page. Now, we need to stop and figure out exactly what we need our game to do and how we're going to accomplish this goal.
It's best to do this planning BEFORE you beign coding, so let's start by listing what the guessing game needs to do, also known as the requirements of the program. This is a small list, but it does say everything we need to do for our guessing game to work. We already took care of the first need, which was to create a random number.
Amaze Your Students With This Math Magic Trick!
So, let's move on to the next requirement, keeping track of the number of guesses. To keep track of anything, you need a variable. In this case, since we're keeping track of guesses, a simple integer variable will do. Add an int variable to your code, and start it off at 0, since at the beginning the player has made no guesses.
So far we have the variable, but it still does not keep track of the number of guesses. At this point it doesn't make sense to make it do so because the user isn't being asked to make any guesses yet. Let's have the computer ask us to guess a number. This is pretty simple, and something you've known how to do since the Hello World tutorial if you've been following along.
Ok, so that requirement is completely done and you can scratch it off your to-do list. Now, we need the player to be able to input the number. This means we're going to need a Scanner. I like to define all my variables as high up in the code as possible, and I suggest you try to do the same.Want to show off a little 'magic' in math class tomorrow?
Let me teach you how to do the coolest and simplest math trick around! I think you're really going to love this one. It's easy to prepare and so much fun to do, even as adults. Here's how it works:. Print out the Magic Math cards page and cut out each of the cards individually. The order of the other 5 number cards does not matter.
Be sure that the student does not tell you what it is. How cool and simple is that trick? There's the old saying that "magicians never tell. Plus, I find that students really get into it because they truly want to learn how to do it themselves. Here's how I generally scaffold the activity, in case you're curious:. I tell them to show their magic trick to their friends in other classes, their family members, their neighbors, etc.
It's a great way for them to practice mental addition calculations through Did your students enjoy learning this magic math trick? We'd LOVE it if you'd share one of these images on social or leave a comment in the space below!
Looking for fun ways to practice addition in your math centers? Check out these and other fun addition games in our store. Cart 0. Here's how it works: 1. If the student says "no," just continue. TIP: Keep a running total in your head as you move through the cards instead of waiting until the end to add them. It's much easier to remember a running total than to remember a bunch of different numbers. Getting students to figure out how it works: There's the old saying that "magicians never tell.
I don't give any "hints" at this time. If not, I keep giving "hints" until we're able to discover how it works as a class. This is so interesting.In this simple game, your computer does all the work. You only have to press one of the buttons, "Yes" or "No".
This is how you play. At the beginning or after pressing "Reset"you think of a positive integer less than At any time, the computer will display a set of numbers.
In response, press either "Yes" or "No" depending on whether your number is on the screen or not. After a while the computer will guess your number. See for yourself. The game's magical powers have a very simple explanation. Computer displays seven sets of numbers. For every i from 0 to 6, it displays the numbers with the same either 0 or 1, selected randomly binary digit in the i-th position counting from right. Answering "Yes" you actually tell your computer whether the digit is 0 or 1.
Thus digit after digit, your computer collects the information about the binary representation of the number you thought up. For example, assume you selected Its binary representation is I have to guess 6 binary digits.
All numbers split into two groups: those that have the rightmost digit 0 and the rest that have the rightmost digit 1. I randomly select which group below to display.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I am very new to programming so I decided to start with Python about 4 or 5 days ago.
I came across a challenge that asked for me to create a "Guess the number" game. After completion, the "hard challenge" was to create a guess the number game that the user creates the number and the computer AI guesses. Notice that it works, however when the computer guessed 74, it then guessed a higher number to The number is too high so the computer guesses a lower number, however the number chosen was Is there a way that I can have the computer guess a number that is lower than 89, but higher than 74?
Would this require additional variables or more complex if, elif, else statements? I used the code from your reply and altered it slightly so the guess is always random. If you see this, let me know if this is the best way to do so. It then checks the midpoint between them. If the midpoint is less than number, the midpoint becomes the new lower bound. If the midpoint is higher, it becomes the new upper bound. After doing this a new midpoint is generated between the upper and lower bound.
This is a bit rusty, but you could improve it by actually narrowing down the choices so the computer has a greater chance of guessing the right number.
But where would the fun in that be? Notice how in my code, if the computer guesses a number which is greater than than the number the user has inputed, it will replace from the randint function with that number. So if it guesses 70 and its too high, it won't choose a number greater than 70 after that. I hope this helps, just ask if you need any more info. And tell me if it's slightly glitchy. This way I actually saw the result when the while loop finished.
If you use the stuff in the chapter guessing this is from the Dawson book you can do it like this. Learn more. Guess the number game optimization user creates number, computer guesses Ask Question. Asked 6 years, 8 months ago. Active 2 months ago. Viewed 32k times. So far I have come up with this and it works, but it could be better and I'll explain. Thank you Ryan Haining I used the code from your reply and altered it slightly so the guess is always random.Now forget about that last question, and just go back to your original number you picked.
Still remember it? You were thinking of the number 1, weren't you?
Picking this number means you are a very independent person. You like your alone time, you work better on your own, and when it comes to leadership, you are number one! Did you really think of this number? Or did we guess it wrong? Tell us in the comments! You were thinking of the number 2, weren't you?Guess the Number Magic Trick Revealed!
Picking this number 2 means you are a very balanced person, you like to look at each conflict from both sides, and reflect back on your life from time to time. You were thinking of the number 3, weren't you? Picking the number 3 means you are a very spiritual person.
You believe in a higher power that guides us, you live your life without looking back, always moving forward. You were thinking of the number 4, weren't you? Picking the number 4 means you are a very intelligent person. You always seek to learn something new, nourish your mind and reach the highest levels of knowledge.
You almost never give up. You were thinking of the number 5, weren't you? Picking the number 5 means you are a strong minded person, stubborn at times, but that usually comes to your advantage.
Can We Guess Your Name?
Your personal freedom is very important to you, and you tend to be very motivated and understanding. You were thinking of the number 6, weren't you? Picking the number 6 means you demand a lot from yourself, you're probably a perfectionist, and you're very intelligent with a great imagination. You were thinking of the number 8, weren't you? Picking the number 8 means you're in a stage of growth in your life. This number represents regeneration and exploration of various possibilities, subjects that you can probably relate to easily.
You were thinking of the number 9, weren't you? Picking the number 9 means you are a very intelligent and compassionate person - what a great combo. Number 9 is the number of Universal love, eternity, faith, and above all - being a selfless soul with tons of strengths.
You won't know if you don't try! Created by Greg Summers. First things first: Pick a number between Got it. Now, tell us your age. Are you currently employed? You like your peanut butter I don't like peanut butter. I don't mind. Now that you're warmed up - Take the number you picked and multiply it by 4.For this to work, we need people who have the means to become paying supporters.
For the month of April we have disabled ads on all E-M content. We need 40 people to reach our goal of 3, active supporters. If we hit that, we'll continue with a new goal in May! What can I say about this game? While there is not much detail put into it, you really have to give it credit because as far as I know, it's a game that just plain works!
You should, however, try to put some more detail into it as there is no sound or background. I think I have played a game like this before and it worked as well. It would take me a long time to figure out exactly how it was done, but I may never. I suppose not knowing how it is done is part of the magician's trick. There really should be more detail put into it.
Everything just seems to have a far too simplistic design in it and there is little to no shading. I suppose that if something works like it should, it is decent. I imagine that it would be hard to put more variety in a game that's strictly a gadget kind and doesn't need flashy stuff to be good.
The things it does have should be of higher quality though.
Not much here, I'd suggest you make a couple of these and put them in a simple game. Still, I smiled when it got the number right. The first step the one with the number grid and the third step the one with the houses are the only 2 steps that matter. Since non of the same colored numbers from step 1 are inside the same house step 3 it can know what color u chose as long as u answer those 2 questions honestly.
Though I think most of it was just randomness put into, such as the crystal ball and the door. Still, good trick for those who aren't suspecting. Please check out our Supporter Upgrade and consider coming aboard! Notice: Many browsers are beginning to disable or hide the Adobe Flash plugin, in preparation for its end-of-life in December If you are experiencing problems playing Flash content, please consider installing our official Newgrounds Player to continue enjoying this content indefinitely.
Launch in Newgrounds Player. Author Comments. Controls: Mouse Instructions: Instructions are on game.