Main method + Cipher/Deciphering + proof


https://github.com/200395/Encryption/tree/master/Encryption (Github link)

Issues: (Look to cipher 2)

This was my original code where I made an array of alphabets that would equal the index number. The issue with this is that certain numbers hold double-digit index’s and the computer reads each individual number. Basically, what this means is that when I decipher for example ‘s’ the value it holds is an 11, but because the computer reads each individual number it will print out as ‘qq’ instead of ‘s’ because it reads it as 1 and 1.

Links used:

For this project, I decided to make my encryption all about substitution so each alphabetical letter will equal a new one. This code was simple because I just had to watch a video about nested loops and chatAt to understand how to program it. On the flip side, because of the simplicity, it is incredibly easy to decrypt.



What have I learned?

  • Nest loops – A loop inside another loop.
  • charAt: runs the character in the specified index.
  • length() a useful method which tells the computer to count the length of the string
  • Empty Strings: Allows you to print what is being looped


  • Scanner class: Review of input
  • boolean operations: Review on using ‘or’
  • if-else statement: Review of if statements


  • Hashmaps: Even though I didn’t use this is my code, from this project I’ve understood it. Hashmaps include an array of numbers, and ‘keys’ are used to identify which hashmap in the value to use.
    • The difference between Hashmaps and arrays/list in terms of storing data is that Hashmap holds a very specific value which is used. So that when you call the key the hashmap that is being identified is specified.
  • Continue: I didn’t use this as well but it basically will execute the condition such as for or do loops. That is why it should be placed within the loop.

APCS(F)- recipe flowchart process

APCSA Recipe

Above is the flowchart recipe.

So the first step in following the flowchart was to go through the whole thing, I then headed to Wellcome to make sure that I got all the ingredients. However, to my dismay wellcome did not have any coriander powder. That being said, I continued on with the flowchart laying out all the ingredients needed.

Next, the recipe called to peel the potatoes.

Next, I attempted to mash the potatoes. This would prove to be difficult because the potatoes were so hard. First, I used a masher than a fork to try to mash the potatoes, but both were ineffective. But I didn’t give up and proceeded to stab the potatoes for a little less than 10 mins, where I conceded.

Robotics(S)- Final Project Reflection

This unit as a whole has been focusing on the sensors and feedback control, with this task we would have a better grasp of the task at hand. Though this doesn’t change/affect the robot in any way (the way it moves) it does give us an understanding of how parts work. In this unit particular, I had to change the motors quite a bit because I had different robots almost every class.

I also found that online resources were extremely helpful such as ‘robotc main page’ which I used exclusively. Here I was able to find the resources needed to program my computer, in addition, it helps me understand parts of robots, such as the pedometer that counts the distance.

The main goal of this task was to apply what we had learned to get a robot dance. Well, we had to formulate code in order to get the robot moving, but instead of looking at the code like our other projects this was solely focused on the outcome. So for this project I had a pool of choice, however, I narrowed it down to two,‘Feel it Still’ by Portugal the. Man and ‘Roses’ by Chainsmokers. I could have chosen any one of these songs and I feel like I would have been really happy with my decision, however, in the end, I choose ‘Feel it Still” because it had a rhythm that was unlike the other songs I have heard. It had a quick beat and quick key changes. Knowing what song you wanted to do was crucial to the process – I had friends that kept changing their songs back and forth, finally ending up at their original song. Now that I knew what my song I wanted to do, I knew that my dance would have to be quick and sporadic, which meant it would be important to get the time right.

Like I mentioned above, unlike the other project we have done where the code was the most important – the outcome of the dance is what was the most important. Parent and students alike wouldn’t need to need to see the code. The code you see below was not my first draft, in the way that I changed the program for my robot more than four times. What I think was the challenge was the transition, it was really tough for me to be able to go from a sporadic tune to a very chorus and soothing tune, I tried a couple of times trying to slow down the robot as it got slower, but it looked very awkward. However the one thing I kept throughout all my drafts was the very first part of the dance where the robot went back and forth – it not only followed the beat, but it also made for a good beat. During this part, I really tried to connect the sound of starting and stopping the motors to be in sync with that of the metronome. At the time I thought I did a really good job, I found the transition time, however, there was a major issue which I will talk about later in my next paragraph. The next things I tried to do was make the arm move back and forth – the only reason why I do so was that in the music video the hand movement caught my attention. After the robot arm went back and forth it would it, it would do a small multitask function here the arm would move while the robot did wheelies. However, I ran into the same problem that I did early which I explain in the next paragraph. The next function was moving the robot in circles stationary. This was a throwback from the very first class, where if you make one motor negative and the other one positive it robot should be spin stationary. This was the just of my dance, I pretty much got this far. But the reason why there are so many lines of coeds is that after I completed what I mentioned above I copy and pasted the exact code and changed some values to match the tunes of the robot. We had quite a few classes to work and I made around a function per class, which honestly aren’t good returns, but a couple of these functions were brand new to me, which I will explain in the paragraph solely dedicated to what I learned throughout this experience.

There were two major problems that were really slowing me down, the matching the start and stop colons and virtual worlds back to the physical robot. The first problem that really slowed me down was matching the start and stop functions mainly because I tried a lot of new things that didn’t plan out like I wanted it to, so I would have to scrap it completely which got me into a hole where I kept deleting and creating new stop of start codons. The second and biggest problem was the transition from virtual robots and physical robots. The problem is that in virtual world it doesn’t account for the power change, meaning that no matter what power the robot is on it looks normal. So when I changed from virtual to physical where the robot looked completely normal and ran extremely smoothly the physical robot flipped multiple times. I wasn’t sure what the problem was until Ms. Mok had explained it to me, and the reason why I hadn’t thought of it was that I never encountered an issue like this. So when I did I wasn’t sure what to do. It was very troublesome to change the robot’s powers completely have to test it by downloading it to the robot so many times. In the end, everything was completely changed, before it worked really well con virtual worlds where the dance went as I wanted it to go, however, as I changed the power level of the robot in virtual worlds performance kept going down. While the performance of the physical robot kept changing mainly due to the robot being used. The issue was the only 3/7 robot were working so I would change the power level of my program depending on the robot, this made it very hard because I kept switching robot which means that I would that the power level would affect the performance depending on the robot being used.

Though I had the issue that greatly changed the outcome of my project, I learned a few things in the coding department and the general use of robotics department. I found out new ways to make asks, such as ‘for’ which proved to be very useful. I really like using ‘for’ because it was a really nice way to keep the function at bay. The next issue I had was the multi-task functions, on the physical robot, the arm and the robot was completely out of sync and/ the motor on the arm was so powerful that robot kept making a crackling sound. I think for future use to make another document of the robot working in virtual worlds and then make another document for the physical robot. In addition, I spent a whole class trying to reorganize my code because the code it self-looked like it was too much. So instead of spending whole class organizing things, I should just start off by making my code concise.

Overall, the main takeaways from this project are to always check on the physical robot throughout the project, I spend so much time and effort on virtual worlds which all went to waste because of the power level. And next time I shouldn’t spend all my time and effort in virtual worlds when the final product and most important part of the summative is on the physical robot. 

Link (Virtual worlds): https://www.youtube.com/watch?v=3bnz0JF6uxE




So Ms. Mok helped me a lot to re-organize my code, originally my code didn’t play out the way I wanted it, instead, it froze after the first line of code. The way she showed me was a similar way of organizing my code when I took intro to programming. I also was able to add multitasking to my code. After Ms. Mok showed it to me it was quite easy to add it. I went to Ms. Mok’s office where she reminded me how to use it, so I quickly added it in. It also lasts for two minutes now too!!!

How to do Multitasking (6 Steps to use multitasking)

  1. Make sure that you open a multitasking sample, the sample program is a very easy way to organize your code for multitasking.
  2. Copy and paste the pragma statements that are needed to be able to run the motors. Also, make sure the motors are connected, make sure they are in the right place.
  3. You will be met with task one, task two, and task main. Task one and task two is basically where you do to do multitasking. While task main is the main program, meaning what the robot runs.
  4. Once you have it task one and task two code you can writeStartTask(One)StartTask(Two)
  5. You can test either one virtual robot or physical robot, the power for each vary so I recommend you test virtual worlds first to see if it does what you want it to do, then test of the physical robot and modify the power.
  6. Troubleshooting: You can go on RobotC and search up multitasking tutorial, or you can look at the open sample and write very basic code to see what your errors are.



Link to virtual worlds: https://youtu.be/Dc0ZL5Dp4bg


Dance Reflection May 7 2018

Today I made good process in the dance, I have a bit less than 200 lines of code while being able to use two different types of functions – for and while. I haven’t gotten the chance to use the robot yet, but on virtual worlds, the robot looks pretty nice.

Unit 2 (S) Reflection

`This unit was really fast-paced, unlike unit one, or even last term in the intro to programming the things we learned didn’t require us to pick it up as quickly. This unit, especially with the shaft encoders was very fast paced, we learned it, and applied it almost instantly. Though it was shaft encoders are new to us it did prove useful in this project. For this project we had to create code to that would allow the robot to complete a course set up in the robotics room. We must go along the white tape, and if by chance the robot went off course and wasn’t in the region of the tape it would DQ. Though this task may sound easy and simple it was quite the opposite. So I had two partners in this projects because I had a track meet, so my original partner had to partner up with someone else while I was running. That being said, both of my partners identified challenges in the course, one being the turn degrees, meaning when the robot would stop and turn. The course wasn’t linear so each turn would have a different degree in which the robot needed to turn. The second problem we identified was the actual, we weren’t sure whether to code in shaft encoders or to go for a very basic route. The third problem was where to start the robot. And the last problem we faced was the robot going off course. The course where the robot had to go through was not straight so nine out of ten times the car would go off course. This meant the code to straighten the robot would not work. This proved a definite issue because it meant we kept going off course and having to DQ. The reason why turning the robot was very difficult was because each turn needed to turn in a different degree non was the same and quite a few of the turns were sharp so it this proved to be very annoying more than difficult. This goes same with how far the robot had to go. This was part of the reason which direction to code the robot was hard, both my partner and I weren’t very familiar with shaft encoders but we both really wanted to use it. So at the beginning of the project for maybe a little less than two class periods we were coding in shaft encoders, however like I said we weren’t too familiar with this way of coding so it took a long time. During the second class period we changed and choose to approach it much more basic, and then once we were able to make sense of the course we would come back coding in shaft encoders. A problem that I didn’t mention was an external problem in the form of the scarce amounts of robots. We would code the robot and not have a robot to test our code in. So to tackle the problem, we would test our code in virtual worlds where we were looking in the robot went along the line of the course. Though this was a solution it was not a permanent one, a lot of the time we had trouble with the measurements. The course in virtual worlds is smaller than the actual one so we weren’t able to see the whole function and most of the time we only saw half of it or a third of the function we had coded. I would in the future like to see a course where there is a big space for the robot to roam freely. I would also like the course to have barriers so the robot would not drop out. Maybe there is already a course like this, I wasn’t looking too closely, however, the few layouts I did use were in a rectangle shape so when the robot turned it would always fall out because it is too narrow. Another external problem I had with the robot is that it didn’t have a battery. The was also a lack of battery packs for the robot, and I guess our class was right before the other robotics class so when we plugged of the robot in it didn’t move because there wasn’t any battery. When we went to change the battery pack, we had the same problem again. So we had to share the robot with another group, where we spent more time re-hooking the robot than the actual testing phase. We decided to use the robot wirelessly because of the face a problem where the robot for some reason would always roll over the A to A cable. And also it proved clumsy having to walk around attached to the robot. I wasn’t able to complete the challenge, because I had to miss a few valuable classes to attend other things. I believe we had around five to six classes to work on this project, and I had to miss two of them due to a track event where we were running against other international schools. This was the issfhk finals so this would be the last run of our league. And the other time I missed class was due to a really bad cold, where I felt dizzy and had a very high fever. These classes were sadly the third last class and the last class of the project. I do however believe my partner was able to complete the course. This project was quite similar to the first unit where we completed courses in the virtual world except a lot harder. This was a nice way to look back at our learning, even though we were doing the same thing we had done in the first unit we had learned new things to help us complete the task, such as shaft encoders, being able to straighten the robot, functions such as while loops, void, if statement and finally having a better understanding of how virtual worlds works. This was a very good representation of what we learned. What I learned from this project is that I wasted too much time by not thinking about what to do. I should have spent time thinking about how I was going to approach the project instead of running into the project head first. And the last thing I learned which is along the line of planning it out is to not underestimate the challenge. If I had planned it out I wouldn’t have faced this problem, but I thought the challenge was quite easy I would have quite a long time to finish it but evidently, I didn’t. Unit 2 has to do a lot with the fundamentals, so this means a lot of functions. I am eager for the next project because I know that I will do a lot better knowing what I know now.

Course Track



Function RobotC

So we today we learned about functions

______ (Function name) = (t)

run1m (t) (how to run functions)

Count statements     =   int count = 0 (Set count to 0 to make it more accurate)

int = integer

at the end write count = count+1 (Add count)

To run write at the buttom task main()

{Function name