Reaction Time

For the past few weeks, I made a game using code for my MicroBit. At first, it was hard because I had to think of what I wanted to do, and then figure out how to turn it into code. The concept of my game was for the MicroBit to show an icon, and then you press the right one on the game board if you didn’t get the right one then it would dock a point from your score. If you spam the score would dock two points, if it was the right one then it would add a point. The game was a two-player game so I had to get one of the players to work, and then I could just copy and make some changes to the second player. Once I knew what I wanted to do it was time to put it in my code. I started off pretty simple by having the MicroBit show a heart icon and set the scores to 0 for the two players. It was set to zero because I don’t want the score to start at any other number besides 0. After it was done, I wanted it to countdown from 3 to 0. Once the countdown was over my code was set to if “on pin 0 pressed” it would show you a check mark and then change the score by one. The same goes for the second player. But as I said before about how I wanted my code to be this was only the first trial of it because I need to know if this would work. The next time I worked on my code Mr. Dembo went over some ideas that people had which some of which were similar to what I was looking to do. My “on start” block had more blocks in it now because I knew what to do now. As I said before the MicroBit is supposed to choose either 1 or 2 randomly. Once it chooses one of the numbers it should show you a certain icon based on the number that the MicroBit chose. I figured out how to have people play the game that I wanted to code but there is only one thing left to do. The last thing was the rounds. At first, I didn’t know how to code that but I figured it out after staring at the code for a few minutes. What I had to do was to set the rounds to 0 at the beginning and at the end of each round have the MircroBit change the round by one. After I had that part I put under “pin 2” an “if……then…..” statement to show you who won after the rounds equaled 5. Something that I learned is that you have to understand what your game is gonna be because if you don’t know then you won’t be able to code it. No one knows what your code is gonna be because it’s your code. Also, you should understand what your code is, and if you don’t then get rid of it, and if you end up needing it you know what it is for already.

Below are the first trial and then tenth trial of my game.

First Trial

Trail Ten

By December 19, 2020.  No Comments on Reaction Time  Uncategorized   

Six Feet Apart

In CSAI Mr.Dembo asked us to code something that would tell you if you were six feet apart from a person or not. He asked us to do this because in this coronavirus era we have to stay six feet. So he wanted us to partner up with someone and start coding. I was partnered up with a kid named Aariz. The two of us started off by testing out if we would get the same number from any signal strength. It was the signal strength because a MircoBit can not measure the distance it can only measure the signal strength if you were to figure out the distance. That was our first trial of testing, we had to remember that if someone has their MicroBit six feet apart from you but has some part of the MicroBit covered then it is going to affect the results of what we see on our LEDs of the MicroBit because the radio signal would have to go through your fingers. Another thing that we had to remember was that if someone had their MicroBit six feet away from you but behind them then that would affect the results again because it would have to go through your body. At first, the two of us forgot about those two things and then we switched by only holding the battery wires as close as we can get to the MircoBit. When we switched to this is made it easier because we immediately had the same number. Once we found this out the class was already over so the next time we had to do it again because none of us remembered what the number was when we tested it out. After we figured out the number which was -75 we had to figure out how we were to code it. This is what we have so far. In the “on start” we have a “radio set group 42” because for us to know what number we have on the MicroBits we have to have the same radio group. Underneath that, we have a “radio set transmit power 7” we have that block because we wanted to have the strongest transmit power the two MircroBits. Then I put a “radio send number received packet signal strength” because I want it to send the signal strength between Aariz and me. I have another set that is called “on radio received received number”  and in that set, I put a “show number received packet signal strength” because once Aariz’s MicroBit receives the signal strength I want it to show the number that is in between us. That was the code to see how much was six feet. Now we had to figure out how to have the MicroBit to show when we are six feet and when we are not six feet. The first thing that the two of us knew was that we had to use an “if…then…” so we dragged out an “if…then…” statement with “received packet received number (greater than or equal sign)  -75″ because if the signal strength between Aariz and I is less than -75 we want the MicroBit to show that we need to move back until we get to six feet. But in order to show that the two of us wanted the MircoBit to show an icon and so we but a frown when we are not six feet. Now we wanted the MircoBit to show when Aariz and I are six feet apart from each other. So we had to use another “if…then…” statement with “received packet received number (less than or equal to sign) -75″ because if the signal strength between the two of us is greater than or equal to -75 then we want it to show that we are six feet or more than six feet and again Aariz and I wanted to have the MicroBit to show an icon and the icon was a smile. So now we have the code but then we have to test it out. The last part of our code was the put the ” radio send number received packet signal strength” We went to go test it out but my MicroBit would show something different than my partner Aariz. My MicroBit would show a frown when his MicroBit would show a smile but then the signal strength between the two of us was greater than six feet. Aariz’s Microbit was accurate when mine was not so I asked him if I could download the that he had to mine. Even though we had the exact same code it did not work. I downloaded his code to my MicroBit but his MicroBit was still correct when mine was not. By this time Mr.Dembo asked the class the gather for a competition to see whose MicroBit was the most accurate. The first round went and then the second I was in the second round. To my surprise, Aariz and I were exactly six feet apart from each other when Aariz’s MicroBit changed to a frown.

You can find our code below.

By November 15, 2020.  No Comments on Six Feet Apart  Uncategorized   

My MicroBit Pedometer

I recently made a code using a MircoBit. A MicroBit is an open-source hardware coding website/chip owned by the company called British Broadcasting Corporation (BBC). I was given the assignment to make a pedometer that tracks how many steps you take. The teacher, Mr.Dembo, gave the class a little overview to give us a kickstart on how our code should look like. I started doing trial and error by the “on shake” input. I made a variable that I named “steps” because it is the number of steps that I want the MicroBit to keep track of. So I dragged the “change steps by 1″ block and put it under “on shake” because when I take a step I want it to count the step I just took as one. I also wanted to have the MircoBit to say 0 when I turned it on. So I had to put a  “set step to 0″ block under the “on start” input. Also, I wanted to see what my number was. So I had to drag over a “show number” block from the “Basic” category and took one of my variable blocks that said “steps” so I would be able to see however many steps I took. I wanted to test the code that I had so I downloaded it to my MicroBit. I went to go test it but then after I counted twenty steps the counter only got four steps. So I went back to my code and looked at it for a few minutes trying to figure out what the problem in my code was. After a few minutes went by I thought that I should make my code more sensitive. I added some other inputs such as “on tilt left” and “on tilt right” because when I take a step my toes would be facing down so it would be tilting to the left, and if I was about to take a step my heel would be facing down so it would be tilting to the right. It made sense to me so I thought that it might work so I downloaded the code to my MicroBit. I went to go test it out but it did not work because I counted twenty steps and the MicroBit recorded 6. Even though it was a little better it was still not accurate. I looked over the code again and then roamed around the categories that MicroBit had to see if any of the inputs would work. I knew that I needed the “on shake” input and that I needed the “change steps by 1″.  So I kept those and then I wondered if it had to do with the force that I walked with. I tried this theory by removing any other blocks that I did not need which were the other “on shake” inputs that I had. After I got rid of all the clutter I downloaded it and then tried taking twenty steps with a strong downwards motion. Downwards motion meaning that whenever I to a step I made sure that it was a big motion so that it might count it better. After I tested the pedometer read 9. Then I thought that maybe the “free fall” block would work because when my foot goes down it would kind of be like a free fall. I also added an “If …. then” statement because if I took a step then it should change the reading by one. But it was only worse after I tested if it worked. So then I took out all of the “on tilt right”, “on tilt left”, and “on free fall” out and then tested it again. This time it did not work because one step would be one thousand something. So I asked for help and Mr. Dembo asked me why I need the “if … then” statement and then I got rid of the “if… then” statement. So I did more coding and then I eventually got it to a point where the code got 10 steps out of twenty. So I thought well I have half of it but it is not counting the left foot’s steps. That was when I thought that I should change the “change step by 1″ to “change step by 2″. I downloaded it and then went to go test it with twenty steps. After my test, I looked at my pedometer and it said twenty! I was like “Yeah! I got it, but will record 100 steps?” because I needed to get 100 steps for the assignment. I tried and then it only recorded 26 steps and then I kept doing it and then slowly I got 100 steps. Whenever I took these tests I would put it on my ankle so that it would be able to get a strong enough shake to record the step. Then the next time my class had CSAI we had a competition to see who would be the closest to 100 and the score that I got was 56 steps in total. So I still have some work to do in order to make this code more accurate in counting steps. If you are interested in seeing the code I used here it is.

Below are some pictures of where you can find the blocks and some of my code because it took nine tries to get to where it is now.

 

 

My first time

My second time

My ninth and final time

My Turtle Art Project

Turtle Art is a coding platform that could help you code many things that you allow it to do. I recently coded a mesmerizing square spiral which could be found here. At first, it looked really hard, but because it looked hard that motivated me to do take the challenge. I started coding by doing trial and error but after a while, I ran into a problem. The problem was that when clicked play to see what it looked like the spacing was all off and the code and my code were a mess. My forwards were all messed up and it just looked really bad. So I changed all of my forward blocks to increase by fives because I do not want to change the angle that it is going at. After my forwards were all changed I clicked on the play button to see if it worked. Once it finished drawing it out the spacing was not big enough. So I changed all of my forwards to increase by tens and that was when I figured out the pattern. After I tackled that problem I found another problem my code was not exactly repeating, and I did not want to use the repeat command because then it would just loop. Now I did not know what to do because I found the pattern and my code was getting too long even though I was using the action block which made it a little neater. Even so, I would have a lot of them when it was not necessary. I asked my teacher for help and I found that I had to use a block that I have never used which was the “Name Store in Value” which could be found in the Boxes section. After I fixed that problem I saw the finish I was satisfied with myself. But then I remembered when I asked my teacher for help he sent me a code that was completely different but the drawing look mesmerizing. I took a look at the code and decided to do it because the color increased and my code only had one boring color. I went ahead and took a look at that code he sent me and added the blocks into my code. Then I played it and then I was not completely satisfied with it. So I kept decreasing the colors when it repeats and I was finally satisfied with it being at 0.3. But then when I was getting ready to make this I wanted you to see all of the colors to I increased it to 0.5 for you to see the purple too. Even though it is more satisfying when it is set to 0.3.


My Code



The outcome

Welcome to my Blog

My name is Sophie Chen and I am a sixth-grader at Quest Academy. I have been a Quest student for one and a half years. My favorite subject is CSAI which stands for Computer Science and Artificial Intelligence. Outside of school, I do some activities such as Kung-Fu, swimming, badminton, golf, triathlons, and Chinese dance. A famous quote that I think is important to my life is”Train Insane or Remain the Same”. To me, it is important because if I do not train hard in anything I do I am not going to get anywhere. I am a person that loves reading and my favorite series is Maximum Ride but I would suggest it to middle schoolers only just because of the language that they use. I enjoy listening to rap music and my favorite rappers are Lecrae, Andy Mineo, and Trip Lee. I am a person who likes to cook and bake and some of the things that I like to make are beef noodle soup, 甜不辣 (tian2 bu2 la4), and grilling veggies. In this blog, I will be taking you through being a sixth-grader at Quest Academy. Such as the projects that I do in my favorite subject CSAI and others to come.



           1                   2                      3     

 

            4   

1 – This is a picture of me (the one is stripes) when I was in second-grade. I was posing with my dance class for the Chinese school handbook similar to a yearbook and a phonebook put in one.

2 – This is a picture of me (the one in pink) when I was in fourth-grade. I was doing a flip in the air with two other guys in Kung-Fu. This was during the end of the year graduation ceremony for Chinese school.

3 – A picture of the quote that I think is important to everyone’s lives.

4 – This is a screenshot of one of my many club records for swimming.