# AP Computer Science Final Project: Flicky Flicker

Day 1: Proposal and idea

I plan to make a spinoff game like Cookie Clicker called Flicky Flicker, I’ll implement everything that I have learned this past year to create this game. The basis of the game revolves around a picture of a head, and from this, you will have a finger that ‘flicks.’

# Encyrption(S)

Flowchart

Main method + Cipher/Deciphering + proof

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.

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.

Flowchart

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.

# Getter and Setter

Today in class we learned the nuances of coding, through getter and setter methods. This method allows us to be able to object traits, such as height, gender, etc. Getter and setter methods rely on the use of datatypes, so during the process, it is essential for the user to put in the right datatypes.

int = number

double = decimals

boolean = true/false

char = letter

Finally, after you define the getter and setter methods, you need to add a return value, which like the words says returns whatever you have stored in the object. The computer is dumb in the way that you have to explain to the computer that these variables need to be printed.

# APCS: Learning Journal #1 (Passing Arguments)

Did you learn something new about computer science/programming in this class?

In today’s class, I learned about passing arguments, which simply translates to the arguments you pass to the method. In essence, the argument (which you can view as ArrayList) move to the method (which is ‘class’). I also learned about the ‘class’ syntax structure.

What are the things you have learned?

learned that ‘void’ is a value with no return, which means that if it did hold value the programmer would use int instead.

Did you find it difficult? Compare writing the program in the terminal with the IDE, which one do you prefer?

I believe that writing in BlueJ was much easier, at first the program as a whole looked very confusing and felt like it was color-coded in a random way instead of having a purpose. However, by the end of class, I strongly believe that BlueJ was much easier to look at. Once you get rid of all the useless text it is any other IDE that runs Java,

# 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.

Edited:

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

# May 9th 2018

Today was very unexpected, I found out that my code is too strong, meaning I have to change most of my values.

# 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.