Friday, February 27, 2015

Friday, February 27th

Today, we had class first thing in the morning. The class was divided in two parts: the first part, Mei and I gave a tour to a class of middle school kids who also work with computer programs and coding. For the second half of class, I just worked regularly.

There is an elective class in the middle school (I'm not sure what it's called) that works with computer programs, very similar to us in fact. It was only coding, however. Only 4 people were in that class (or at least only 4 people came to the library). Mei and I started off by  giving them a description of what the course computer applications is. We explained to them that this class was like no other- we came in, and there is no "paying attention to the teacher for 80 minutes". We come in, sit down, and work on whatever we are working.

We then proceeded to go around the table at which everybody was sitting, and one by one, each person explained what they were working on, and how it was going. Natalie, for example, said that she was using Greenfoot and that she was working on a few games. One of the kids even tried her game.
It was interesting for them, but it was also interesting for me because I didn't actually know what some people in the class were working on but I found out. I found out that Martynas was working on HTML, and that Tomas was working on modifying games.

After giving the tour of the class, we switched roles and gathered around the kids, who then showed us what they were working on. They worked on a program called Scratch, which very much resembled the Hour of Code that we worked with earlier this year. They worked on game, and the code was created exactly like it was with the Hour of Code: with blocks.

After that little tour of the class, I got back to work. I got lucky and had a lot of easy problems until the end of the class, they weren't hard at all. Here is one of them:

----------------------------------------------------------------------------------------------------------------------------------

Given an array of ints, return true if the number of 1's is greater than the number of 4's 

more14({1, 4, 1}) → true
more14({1, 4, 1, 4}) → false
more14({1, 1}) → true



public boolean more14(int[] nums) {
  
  int sum1 = 0;
  int sum2 = 0;
// create two different sums, one for each time there is a 1, and one for each time there is a 4.
  
  for (int i=0; i<nums.length; i++)
  {
    if (nums[i]==1)
    {
     sum1=sum1 +1;
// if there is a 1 in the array, add 1 to the sum for the ones.
    }
    
    if (nums[i]==4)
    {
     sum2=sum2 +1;
// if there is a 4 in the array, add 1 to the sum for the fours.

    }

  }
  
  if (sum1 > sum2)
  {
    return true;
// if the amount of 1's is greater than the amount of 4's in the array, then return true.
  }
  
  return false;
// if there are more 4's than ones, then return false.

}

Looking forward to continuing with loops!















Wednesday, February 25, 2015

Wednesday, February 25th

Regular class today.

I am slowly getting the hang of the new concept of for loops. I am learning how to use them but still am not used to them completely. Since I don't really have a lot to say, I'll get straight to the problem of the day:

Return the sum of the numbers in the array, returning 0 for an empty array. Except the number 13 is very unlucky, so it does not count and numbers that come immediately after a 13 also do not count. 

sum13({1, 2, 2, 1}) → 6
sum13({1, 1}) → 2
sum13({1, 2, 2, 1, 13}) → 6

------------------------------------------------------------------------------------------------------------

public int sum13(int[] nums) {
 
  int sum = 0;
//define the sum as an int starting as 0.
 
  for (int i=0; i<nums.length; i++)
// write the loop
  {
    if (!(nums[i]==13))
// if an element doesn't equal 13
    {
      sum=sum+nums[i];
// then keep on adding to the sum;
    }
   
    else
    {
     i++;
//if it does equal 13, then don't add anything to the sum and skip 2 elements, because we want to skip
// 13 and the number that comes after it.
    }
   
  }
  return sum;
// return the sum of all the ints, besides the exception of 13 and the number that follows it.
 }
----------------------------------------------------------------------------------------------------------------------------------

On Friday, we won't be having a regular class. Since it's library technology week, we are going up to the library and working there. Mei and I will be sort of "touring around" the middle schoolers that are coming to visit and we will be taking them around the library, introducing them to everybody who will also explain what they are working on. Basically, we will give them a little taste of what we do in class and how it works, and what are the things that people do. Looking forward to it!

Monday, February 23, 2015

Mid-Quarter Report, February 2015

Mid Quarter February 2015
Describe your learning so far in this course.
I've progress incredibly in coding Java, and the logic that it takes to answer these problems comes more and more easily to me. I've been learning about loops and arrays also, and I am hoping to use and expand that knowledge for the best.












Your teacher will be entering a grade-in-progress in PowerSchool for mid-quarter. He will be considering your performance in terms of the assessment guidelines. At this stage he will be asking about the extent to which the statements below apply to your performance in the course.
Look at the statements in the column on the right.
 Comment on the extent to which the statement describes your performance.
 Are you meeting this standard?
 Do you feel that you are exceeding the standard? In what way?
 Are you falling short in some way? What could you do to improve your performance?
Give a summary description of what you have learned so far in this course.
So far in this course, I've accomplished part of my goal, which was to finish level 1 on CodingBat. My next objective is to finish level 2 and get comfortable with that.



I learned the basics of strings and arrays, and  now I will be using those fundamentals to apply it to solutions which include loops.






Typically this student makes effective use of class time by increasing his competence and confidence using software that he has chosen.
Does this statement describe your performance exactly?

Yes.
In class, 99% of the time I am always working on a problem. I am working on CodingBat or writing on paper to try to solve the problem. If I am not in my usual spot, then I'm talking to Mr. Daly about a problem.

She attends all class sessions, coming and leaving on time, making sure to make up missing time by working during free periods or at home.
Does this statement describe your performance exactly?

Yes.
I always come to class on time, and never leave before Mr. Daly dismisses us. If I do happen to miss a class, I will always work at home to make it up. Sometimes I even do one or two problems simply to get ahead for class.

His oral communication during class is focused on the learning tasks that he is engaged in.
Does this statement describe your performance exactly?
Yes.
If I talk to somebody it is either to Mr. Daly or somebody that does coding. When I talk to Mr. Daly, it is because he is helping me solve a problem but if I have a more minor problem then I will ask one of my friends about it.
How can you improve your performance in this area?

At the beginning of class, I could talk less to my friends before getting set up.





His written communication (blogs, e-mails, and reports) are done according to deadlines and contain enough information for the teacher to understand what he is doing, what kinds of problems he is facing and how he feels about his learning experiences.
Does this statement describe your performance exactly?
Yes.
I always submit my blog posts on time (except one this quarter). I write thorough blogs which clearly describe what I am working on, my struggles and issues with the problem, what I think about the work I'm doing and what I plan to work on next class.
I also include a problem that I solve in each blog.

During class he/she remains focused on the task at hand and generally respects the integrity of the learning environment for all students.

If the statement does not describe you exactly rewrite the statement so that it does.

During class, he remains focused 90% of the time on the task at hand and generally respects the integrity of the learning environment for all students.



How can you improve your performance in this area?

I can improve my performance by getting less distracted in class.
He/she has positive attitudes towards acquiring technology skills, and makes a conscious effort to acquire new skills and apply them in meaningful ways.
Does this statement describe your performance exactly?

Yes.
I always try my hardest, and whenever I step in to class I am always ambitious and happy to get to code. I always want to learn more and am always eager to solve a problem.

He/she is an independent learner, who tries to solve problems by himself/herself, but finds effective ways to overcome problems using a variety of other resources.
Does this statement describe your performance exactly?

Yes.
Before going to see Mr. Daly, I always try everything and anything that I can to solve the problem. It is only if I really can't figure it out after at least 5 minutes of thinking on it that I go to see Mr. Daly.

He/she is respectful of all members of this learning community and his/her behavior is in compliance with all school policies, in particular the RUP (Responsible Use Policy) and Academic Honesty Policy.
Does this statement describe your performance exactly?


Yes. 
I never disrespect anyone in the classroom or disrupt them from their work. I let them do their thing as I do my own.


This is an appropriate course for this student and the performance of the student is such that it can be said that the student is meeting the standards well. His work, on the whole, is good.
Does this statement describe your performance exactly?

Yes.

I feel like this course is not ridiculously hard yet it is not easy at all. The work that I do and the amount that I complete is perfect for this class and I believe that I am going at the right pace for this class. This is definitely the class for me.


She is making good progress with her chosen module. She is learning new techniques each class and building on her previous knowledge.
Does this statement describe your performance exactly?

Yes. 

I am progressing a lot. I have learned so many new coding skills thanks to coding bat. As I progress through the levels, I need to apply what I previously did to new and more complex codes. I finished Level 1 and will now be moving on to level 2. 









What grade-in-progress do think accurately describes your overall performance in the course so far?
A-Outstanding
B-Good
C-Adequate
D-Inadequate
A- outstanding.
Does the structure of this class suite your learning style? What could be done differently?
The structure of this class is perfect. I am allowed to work on whatever I feel I need to work on and at my own pace always. I like it. One thing I believe is needed though, is 5 minute breaks every once in a while, as it can be hard to keep focus for 80 minutes straight. 








Do you feel that you understand how assessments are made in this course? Do you have any questions or comments at this stage?
Yes. I have no questions.

Thursday, February 19, 2015

Thursday, February 19th

Today was our first class back from TIMEMUN. It was also our only class this week.

I finally finished level 1 of CodingBat! But it was then when I learned about for loops that I realised that all of the level 1 probably were ridiculously easy... And I will probably say the same about Level 2 when I finish it.

After finishing Level 1,  Mr. Daly explained to me what Loops were. We only really went into for loops, which was the most important and probably most common types of loops that I will work with. He explained to me that now with loops, we can go into much more advanced things and we can really mess around with an array more than before in Level 1. The array could be length 12010284, for all we know, and with the loop we would be able to find anything that CodingBat asks of us in a few short lines of code.

A lot of the time, the code will look like this, and will most likely have an if-statement inside of it.
{
for (i=0; i<nums.length; i++)
{
   if (        )
   {
      ___;
   }

}

 return __;
}

Of course, everything is still new to me. I think that I understand the basic of basics of how to use these loops, but I'm sure as time goes on I will get more and more familiar with them. I will be starting with Array 2 in Level 2.

Anyways. Since I just finished the easy type arrays and I also don't really know much about for loops at the moment, for this blog I'll put one last problem from Level 1:

 ---------------------------------------------------------------------------------------------------------------------------------
Given 2 int arrays, a and b, return a new array length 2 containing, as much as will fit, the elements from a followed by the elements from b. The arrays may be any length, including 0, but there will be 2 or more elements available between the 2 arrays.

make2({4, 5}, {1, 2, 3}) → {4, 5}
make2({4}, {1, 2, 3}) → {4, 1}
make2({}, {1, 2}) → {1, 2}





See you on Monday.












Friday, February 13, 2015

Friday, February 13th

Today was a half day, so only about 45 minutes in class. Yet surprisingly, I still managed to get a lot finished. I'm really flying through the Arrays.. in simply 45 minutes I got 7 of them done ! I didn't feel like they got harder at all except the last three which I still need to complete two of. I did the first 6 problems easily, and then on the last one I did I needed some help from Mr. Daly and after looking at the last two at home also I will be asking Mr. Daly for help when I get back to school.

Here is the first problem of the last three, the most complicated one for now:


We'll say that a 1 immediately followed by a 3 in an array is an "unlucky" 1. Return true if the given array contains an unlucky 1 in the first 2 or last 2 positions in the array. 

unlucky1({1, 3, 4, 5}) → true
unlucky1({2, 1, 3, 4, 5}) → true
unlucky1({1, 1, 1}) → false



Next class I'll finish arrays for sure. Mr. Daly said he would talk to me about loops also.

Wednesday, February 11, 2015

Wednesday, February 11th

Today was an amazing day !

For the first time ever, we got a customer at the Genius Bar ! It was somebody unexpected: Yessin. Since he isn't in our computer apps block anymore, he has free during E block. He was in the library, doing some work on his computer when all of a sudden it got stuck. He didn't know how to use the Ctrl+Alt+Delete so he came and I helped him unfreeze his computer. I was glad to finally be able to help somebody when up at the Genius Bar.

For more good news, I flew through the Arrays today! I finished more than half of them. I completed 9 problems today, and I only have 9 more left ! This is a lot faster than strings - although there are less arrays than strings. If I continue working at this pace, I should be able to finish in the next two classes ( I am assuming I won't finish 9 problems next class because they get harder and harder towards the end).

They were relatively easy, and what especially helped me today was drawing out the arrays and each int value.

The problem for today required a little bit of different thinking. I will admit, that I did search for a hint about how to solve it. But once I had the right idea in mind, I knew exactly what to do.

Here it is:

Start with 2 int arrays, a and b, of any length. Return how many of the arrays have 1 as their first element. 

start1({1, 2, 3}, {1, 3}) → 2
start1({7, 2, 3}, {1}) → 1
start1({1, 2}, {}) → 1


public int start1(int[] a, int[] b) {

int counter =0;
// create a counter that starts counting at 0.

  if (a.length>0 && a[0]==1)
  {
    counter ++;
// if nums a has the first element as 1, then increment the counter by 1.
  }
  
   if (b.length>0 && b[0]==1)
  {
    counter ++;
// if nums b has the first element as 1, then increment the counter by 1.
  }

return counter;
// return the value of the counter. 
// what we did with this was that we simply added 1 to the counter every time an array fit the 
// conditions stated. This way the counter could be incremented to 1, to 2, or it would stay at 0
// if none of the arrays had 1 as their first element.

  }



I hope to finish Arrays very soon. 















Monday, February 9, 2015

Monday, February 9th

That's it, today I finally finished String 1. They were three very complicated problems, especially the last one. The first two together took me about 30 minutes, but eventually I understood them but the very last problem I just couldn't seem to solve by myself, so I requested Mr. Daly's help and we solved it together.

After finishing String, I went on to Array (on which I already begun, if you remember, but I left it early to finish strings). I had many problems left to do and I had kind of forgotten how to do Arrays and how to solve problems with them, so I did a few with Mr. Daly. I think what I find will help me with Arrays is drawing it out. Especially arrays, which have numerical values assigned in certain places - to draw everything out would help me with the problem.

Anyways, since we won't be seeing strings for a while, I figured we would do one last String problem, the last and very complex one:


Given a string, if one or both of the first 2 chars is 'x', return the string without those 'x' chars, and otherwise return the string unchanged. This is a little harder than it looks. 

withoutX2("xHi") → "Hi"
withoutX2("Hxi") → "Hi"
withoutX2("Hi") → "Hi"

-------------------------------------------------------------------------------------------------------

public String withoutX2(String str) {

  if (str.length()==0)
  {
   return "";
// if there's no character's, there can't be any x's so return an empty string.
  }
  
  if (str.length()==1 && str.substring(0,1).equals("x"))
  {
   return "";
// if there is only one character and that char is x, then  we want to get rid of it so return an 
// empty string.
  }
  
   if (str.length()==1 && !str.substring(0,1).equals("x"))
  {
   return str;
// if there's only one char and it's not x, then we don't want to get rid of it so just return the 
//  original string.
  }
  
  String theEnd = str.substring(2);
// we define a temporary string, which is the string from the 3rd character until the end.
  
  if ((str.substring(0,2).equals("xx"))) 
  {
    return theEnd;
// if the first two chars are x, then get rid of those and return the string from the 3rd char on.
  }
  
  if (str.substring(0,1).equals("x"))
  {
    return str.substring(1);
// if the first char of the string is x, then return the string from the first char on.
  }
  
  if (str.substring(1,2).equals("x"))
  {
    return str.substring(0,1) + theEnd;
// if the second char of the string is x, then return the first char of the string + theEnd, which is 
// the string from the 3rd char on.
  }
  
  return str;
// if the string does not fit any of the conditions above, then just return the original string.

}

---------------------------------------------------------------------------------------------------------

Onwards to Arrays! I will be sitting next to Preston from now on because he also is working on Array 1 and we would be able to help each other.

Sunday, February 8, 2015

Thursday, February 5th

*I am sorry for the late post. This is one of the few times during the semester where I forget to post the blog on the day of...

It was a good class today. I did a lot done, and now I am very very close to finishing String 1. I only had 4 problems left when I left class, but over the weekend I did one more so I have only three problems left.

The problem I will be showing you today is the one that I did at home, and it was more complicated than I expected it to be and it took me a while to finally get the logic straight.

Given two strings, append them together (known as "concatenation") and return the result. However, if the strings are different lengths, omit chars from the longer string so it is the same length as the shorter string. So "Hello" and "Hi" yield "loHi". The strings may be any length.

minCat("Hello", "Hi") → "loHi"
minCat("Hello", "java") → "ellojava"
minCat("java", "Hello") → "javaello"





Next class I will definitely finish String 1, and then continue to Array 1.






Tuesday, February 3, 2015

Tuesday, February 3rd

Went upstairs to the Genius Bar with Tommy today. I tried to advertise it because we haven't had one single customer since the beginning of the genius bar... but still no luck. Oh well. Maybe next time there will be somebody...

Besides that, I worked on String 1. I am approaching the end, but I find that the problems are so annoying. I get the general idea most of the time, but there is always one thing missing... and for that reason I don't complete the problem completely. I only really completed two problems today because all the rest had one run that didn't work or something like that... I need to show Mr. Daly these problems on Thursday. There was even one problem, where it showed that the test runs were all correct - but "other tests" was false. How am I supposed to know what to fix in that situation?! It doesn't tell me anything. Thanks CodingBat.

Anyways, today's problem:

Given a string of any length, return a new string where the last 2 chars, if present, are swapped, so "coding" yields "codign". 

lastTwo("coding") → "codign"
lastTwo("cat") → "cta"
lastTwo("ab") → "ba"



public String lastTwo(String str) {


  if (str.length()<=1)
  {
   return str;
// if the string is shorter than 2 characters, then there can't be 2 characters at the end.
  }


  return (str.substring(0,str.length()-2)) + str.substring(str.length()-1) 
//return the string from the beginning to 2 letters until the end + the last letter of the string

+     str.substring(str.length()-2, str.length()-1);
// add to that string the second to last letter from the original string

// in the end, we will have the string with simply the last two letters inversed.
  
}


I know that it seems like I am not progressing much by simply doing CodingBat every class, but the amount that I am learning each time is incredible. Once I finish level 1 of CodingBat I will probably look to move onto something more of my own, like a project of some sort.