APCSA | (d)Encryption Program

My video answers the below questions:

Guiding questions and instructions for your blog post

  1. What encryption method have you chosen, why did you choose it?
  2. What are the pros and cons of this encryption method?
  3. Include sketches (e.g. flowchart, pseudocode, diagrams…) you drafted before writing the code.
  4. In the screencast, show the classes hierarchy of your program
  5. Explain the functions of different methods
  6. Demonstrate how your program encrypt and decrypt a message
  7. What have you learned in this project and how does it connect with the topics we covered? (String operations, arrays, loops…)

Github Links:

Cipher

Decipher

Main Class

 

Resources Used:

“Java Tutorial – Caesar Cipher” by Zoran Davidović

“Atbash Cipher” by Hanging Hyena

APCSA | Algorithms and Iterations

An algorithm is simply a set of instructions, similar to a recipe, that is used to run a task or solve something. A form of displaying an algorithm is through a flowchart, where the user moves from the top of the chart to the bottom, answering questions/conditions along the way. Algorithms progress by checking comparisons and conditions, often with results like “yes” or “no.” Algorithms are often compact, and can be repeated as an iteration, which is simply a repetition of these algorithms, with some small adjustments, such as variables or inputs. In addition, algorithms are usually very general.

 

APCSA | Blog Post 2

Enduring Understandings

  • Computer programs is based on source code and required processing (compiling/interpretation) before execution. [completed]

Essential Questions

  • How to write a computer program?

Class Content

  1. Basic arithmetics in Java

  2. Different datatypes in Java Language

  3. Differences between int, double and float

Write a post on your learning journal

Slide (http://skylit.com/javamethods/ppt/Ch05.ppt)

Reflection homework – blog or video describing what you learned this class. Did you have any difficulties you had to overcome? Any questions, left unanswered? What did you do this lesson that was successful?

Nope 🙂

What is the difference between double and float? (can also watch video)

Float – Less precision, requires space for • 10^x. Bigger numbers, less space. 4 bytes.

Double – More precision, takes more space. 8 bytes.

How does args work in the main function? Can you name args something different? explain and remember to add images to help visualise.

Args are the argument. You can name them anything you want, as long as you are consistent.

APCSA | In-Class Exploration Task

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

Yes

What are the things you have learned?

It is epic B))

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

Yeah a littleb ut im rely good at computers B))

Finally, upload the video you’ve created in class on youtube and embed it in your youtube channel.

 

Robotics | Final Project Reflection

Throughout this project, I’ve utilized many programming skills to achieve a robot dance synced to the tune of the song, “Eye of the Tiger.” The project has taught me a lot about programming, problem-solving, and working together as a team.

 

There were many new programming concepts taught for this project. We learned about while loops, which allow us to loop a portion of code consecutively. We learned about functions, which allow us to call a set portion of code at any time. Personally, I used functions repeatedly in my code. I used them far more than while loops, because the song I chose is not very regular. With a function, the programmer can define integers, and modify values within the function itself. Functions are very useful for condensing code, my code would have been significantly longer without them.

To define a function, you need to write “void functionname()” and {} will contain the code of the function. You can then call the function at any time by simply writing the name of the function followed by (); In the round parentheses, you can put an integer if you’d like.

An example of a function (stop) with an integer (time):

 

Syncing the robot’s dance to the music was quite a complicated task. At first, I tried to count the seconds of specific parts of the song, and using the Youtube video’s progress. For example, the first move I wanted my robot to initiate began after eight seconds of the song, so I made sure my robot was stationary for 8000 milliseconds. Despite this, I found 9000 milliseconds (9 seconds) to work better in my code, so actually using the precise measurements was a somewhat ineffective strategy.

Using this strategy was a good starting point, but I found trial and error to be far more effective. With the help of virtual worlds, I repeated dance moves over and over until I got the timing to a level in which I was satisfied with. For trial and error, I would put in my closest estimate, try it out, and adjust the value depending on how the timing was.

Another factor that disrupted my timing was the power of the motors on the physical robots. Due to the age and use of the robots/parts we used, our actual robots were not as powerful as the one in the virtual world. An example of this is when my robot wouldn’t move as far in the real world as the virtual world, or it wouldn’t turn as quickly. The motors, battery, and several other parts all worked less well than in the virtual world, so I had to adjust my code to accommodate this.

One thing that really messed with my entire dance was when I was informed of the size of our area. My robot’s dance relied on a large, open space, so when I learned of our restrictions, I was forced to change my code.

 

I really like some of the moves I accomplished with my robot. It definitely works better in virtual worlds, because the motors on the physical robot are old, and they don’t work as well as they should. The beginning part (the shuffling to the beat of the song) was incredibly satisfying to get in sync. Though some may think it repetitive, I personally think this is one of the strongest parts of my entire dance. Another original move is when I have the robot’s arm go up when the singer says “rising up.” I thought it was quite clever, and watching it move in sync with the music after all of the work it took was very satisfying.

 

I think the greatest strength I demonstrated in this project was not programming-based at all. This skill I demonstrated was good teamwork. When others were struggling with their robots, I would take considerable time away from my own project in order to help my peers. If someone was struggling with understanding a concept, I tried to explain it to them. If someone was unsure about an unexpected outcome from their code, I would help troubleshoot, and then suggest various solutions. If a robot was unstable, a screw loose, a motor unplugged, a wire jammed, I’d usually be offering my advice to my peers. There were also times where I struggled, and I had many friends to turn to. I also asked for help, and received it, from my peers. This project may have been a test of our programming skills, but it brought out a collaborative nature in the class.

Robotics | Final Project Progress Update

How much have you done so far?

So far I have around 50 seconds of the dance done. I have a good plan of what I want to do next with my robot, and I’ve synced the completed 50 seconds quite well. The robot shuffles left and right to the sounds of the song, “Eye of the Tiger.” It performs quick swing turns for the beginning sequence corresponding to the quick parts, and does a long swing turn for the longer sections.

 

What are the different programming techniques that you used? Are you using any sensors?

I am not currently using any sensors, and due to the fact that we haven’t been taught how to use them, I don’t see myself using them in the future. The most useful technique I used was functions. It saved me a lot of time, as I didn’t have to repeat the same code over and over. I was able to make my robot do the same amount of actions in far fewer lines of code.

Using a function like one of these:

 

I can condense what would be the same three lines of code repeated constantly to this:

Although this also looks quite repetitive, it would have been at least three times as long had I not used functions. With these functions, I use an integer in the circle parentheses for the variable of time. I could have condensed my functions within another function, however I personally preferred to list them in this way because the song’s notes are not always in a linear pattern (this is why the numbers are of different values).

 

How do you tackle the sync issue?

Syncing the robot’s dance to the song is perhaps the most difficult parts of this project. To start, it is good to get a general idea of when you want your robot to perform the move. In my case, the first action I wanted my robot to perform was around eight seconds in to the song.

Although using the actual millisecond values for parts of the song is effective, it can sometimes be hard, especially if the song is very complicated. Once you get a general idea of the location in time that you want your move to be performed, it really comes down to trial and error. I listed 8000 milliseconds (8 seconds) at first, but after trying if a few times, I found that it synced better with 9000 milliseconds (9 seconds). It would be very unpractical to do trial and error on an actual robot, so I spent a lot of time in virtual worlds.

 

Any other challenges you encountered during the development process?

Despite my success in the virtual world, I am still unable to get my code to work with an actual robot. I spent an entire lesson trying different robots with my code, and I came to the conclusion that there was a problem with all of the batteries that I tried using. To fix this issue, I need a robot that is guaranteed to work, one that I know has absolutely no problems with its motors, cortex, or battery.

 

 

Robotics | Functions

Today, I was extremely excited to pick one of my favorite songs of all time for my robot to dance to, however, my song was rejected as “too controversial,” despite it being the national anthem of a country >:(

 

I also learned how to use functions. I got my robot to shuffle in virtual worlds, and I’m going to make it move to the beat of “Eye of the Tiger.”