Hopscotch Academy - Always accepting new students and teachers!

codinghelp
coding
school
#258

To be honest at school we spent to long on absolute value. It is just the distance a number is from zero…and it is always a positive number!

3 Likes
#259

Yeah, I knew that, but I can’t use it in HS.

3 Likes
#260

To be honest, you do make pretty advanced projects in HS. Maybe you could share some more knowledge here!
@sophia71205, thank you for the update!
@HopscotchRemixer, I don’t know why anyone would need to spend a whole lot of time on absolute value if it’s just what you say…

4 Likes
#261

Absolute value is easy. The absolute value of -4204 is 4204. The absolute value of 4204 is 4204. I would use it for customizable projects.

I haven’t done it on school yet. Sounds fun. Like spring break for math.

2 Likes
#262

Okay… I feel like I would be rubbish at teaching basic operations because I don’t know what I would use them for. But I will teach Booleans :wink:

3 Likes
#263

Absolute value

Have you ever seen this and been confused? Well, don't be confused. Absolute Value is simple. I have an explanation and an example project.

is the distance from zero.

For example, the absolute value of bot 10 and -10 is 10.

In Hopscotch, it’s almost like the opposite of multiplying something by -1. However, the complete opposite of is two math operators, including . That is the essence of the example project. Please look over these images which explain the opposite of .











@HopAcademyStudents

Please inform me of any questions about .

3 Likes
The MatHS Team Collab!
Hopscotch Academy 2 - Always Accepting New Students And Teachers!
#264

As in 0 and 1? Hopscotch doesn’t technically have actual Booleans.

2 Likes
#265

Technically, you didn’t need to use absolute value for your situation…

2 Likes
#266

Yes, that would be 0 and 1. I realize that HS does not have real booleans, but 1 and 0 are close enough :wink:

4 Likes
#267

I know. I was showing what it could do. That is also how I’d make a customizable game, as well as how I’d be be lazy.

2 Likes
#268

How to use booleans in Hopscotch

What is a Boolean, you ask? A boolean has two states, true or false. Although there are no true booleans in Hopscotch, you can use variables set to 1 or 0 to represent the same thing. Today I will show you how to use booleans. Without further ado, let's get started!

First, let’s talk about what booleans do. Since a Boolean is either true or false, they can be used for a certain type of logic. For example, you could have an AI cat that only eats food when it is outside. It would choose a random position – half of the positions are outside, and half are inside. The computer would check to see if the cat is outside or inside. If the cat is outside, it would set a Boolean variable called catOutside to 1 (which represents true). If the cat is inside, then it would set the variable to 0, or false. Then it would check to see if the catOutside variable is 1. If so, it would tell the cat to eat. This is only one of the many uses for Boolean variables!
Now let’s get started.
This is an example of what a program that I made does –


When the answer is true, it shows a 1, and when the information is false, it shows a 0.
Here is a bit of the code behind it -

  1. Make a line of code that tells the emoji text to pick a random number from 1 to 3. And then tell it that when the number equals 1, make the emoji a certain one, and set the booleans to the correct values. Same for two and three.

The rest of the check once if statements

  1. For my program, I wanted it to give information on whether the emoji that I was showing was human or dog, happy or sad, and an emoji or not. So I put some text in telling me what each variable meant (the part that says “are you an emoji?” “Are you a dog?” Etc.), and I put a corresponding text object to each question.

    For each corresponding text object, I put a set text block inside a forever loop, like this.
  2. I repeated this process for all of the text objects, changing the variable from “IsSmiling” to “IsCrying”, etc.
  3. And that was my program. Some other examples of programs using Boolean logic are -
    Artificial intelligence
    Logic gates and circuits

Homework -
Explore booleans a bit more, but you don’t need to make anything.
Look at this project –

5 Likes
Hopscotch Academy 2 - Always Accepting New Students And Teachers!
#269

I THOUGHT IT WAS MULTIPLE CHOICE :stuck_out_tongue: Oh well…
I will be a teacher I guess :stuck_out_tongue:

2 Likes
#270

I’ve tried to do that but what I did wrong was that I didn’t make a self value for the X position.

2 Likes
#271

Okay! Just fill this form out –

Hopscotch Username:
How long you have been on hopscotch:
Your strengths on hopscotch:
How often you are on:
Anything else:

I would love to have you on board!

3 Likes
#272

Optional Homework Lesson!
(This is kinda personal for me anyways)


Can someone debug this Project? I made it and I need some people to help me with it. I will give credit!

2 Likes
#273

@WynterDiamond mm… k…

2 Likes
#274

Okay! I’ll add you in. You can start making tutorials at any time :wink:

3 Likes
#275

I am excited to learn a lot of new things!

3 Likes
#276

Okay :smiley:
I will add you to the group. You can start taking a course any time!

2 Likes
#277

Okay, thanks, Wynter!

3 Likes