## Coding Bat – delDel

This exercise requires that the program analyze a string to see if it contains the word “del” starting at index position 1. If it does, it is to remove it and display the word with the “del” removed.

```public String delDel(String str) {

}```

As you can see, we have a single string variable named “str”.

```public String delDel(String str) {
if(str.length()>=4 && str.substring(1,4).equals("del")){
return str.substring(0, 1) + str.substring(4);
}
return str;
}```

This solution utilizes a conditional if with the Boolean AND to solve the problem.

We start by looking to see if the string is 4 or more characters in length AND if the string starting at index 1 to 4 is “del”.

If this Boolean is TRUE, then we return the string from index 0 to 1 concatenated with the string from index 4 to the end.

If this Boolean is FALSE, then we simply return the string unmodified.

## Coding Bat – Cluster 2

Today, while I was working with the FTC 11242 (ERROR 404) robotics team at Ferris Intermediate School for our community outreach efforts, my Computer Science class was assigned to complete 4 different Coding Bat assignments.

#### CODING BAT – firstTwo

This exercise requires that the program return only the first two characters of a provided string.

```public String firstTwo(String str) {

}```

```public String firstTwo(String str) {
if (str.length() < 2){
return str;
}
String firstTwo = str.substring(0,2);
return firstTwo;
}```

The solution above first uses the length method of the String class to determine if the string is less than 2 characters long. If it is, then the entered string is returned as the solution (lines 2 – 4).

Lines 5 – 6 are executed if the string is 2 or more characters in length and uses the substring method of the String class to capture the characters from index 0 to index 2 (first 2 letters of the string) and assigns them to the variable named firstTwo and then returns the value of that variable.

#### CODING BAT – extraEnd

This exercise requires that the program take the last two letters of the provided string and create a new string that repeats them 3 times.

```public String extraEnd(String str) {

}```

```public String extraEnd(String str) {
int strLength = str.length();
String lastTwo = str.substring(strLength - 2, strLength);
String extraEnd = lastTwo + lastTwo + lastTwo;
return extraEnd;
}```

Whenever we are doing something involving the end of a string, we must first calculate the length of the string (line 2).

Once we know the length of the string, we can come back 2 characters (line 3).

We then use concatenate to repeat the last 2 characters 3 times (line 4) and output the final solution (line 5).

#### CODING BAT – conCat

This exercise requires that the program take two entered strings and concatenate the first with the last. However, if the last character of the first string and the first character of the last string are the same, they are NOT to be repeated and one is to be removed.

```public String conCat(String a, String b) {

}```

```public String conCat(String a, String b) {
int aLength = a.length();
int bLength = b.length();
if (aLength == 0 || bLength == 0){
return a + b;
}
String aLastLetter = a.substring(aLength - 1, aLength);
String bFirstLetter = b.substring(0,1);
if (aLastLetter.equals(bFirstLetter)){
return a + b.substring(1, bLength);
}
return a + b;
}```

The solution above first determines the length of the two strings (lines 2 – – 3). We then look to see if either of the strings is empty (lines 4 – 6) and return the strings as they are.

If both of the strings have text, we then look to see what the last letter of string a is (line 7) and the first letter of string b (line 8). We then compare these two letters to see if they are the same (line 9). If they are, we return string a concatenated with string b with the first letter of string b removed.

If line 9 is false, then we simply return string a concatenated with string b.

#### CODING BAT – theEnd

This exercise requires that the program display either the first letter of the string (if the Boolean front is true) or the last letter of the string (if the Boolean front is false).

```public String theEnd(String str, boolean front) {

}```

As you can see, we have a string variable named str and a Boolean with the value of front.

```public String theEnd(String str, boolean front) {
int strLength = str.length();
String strFirstLetter = str.substring (0,1);
String strLastLetter = str.substring (strLength - 1, strLength);
if (front == true){
return strFirstLetter;
}
return strLastLetter;
}```

As always, when we’re asked to do anything with the end of a string, we must first calculate the length of the string (line 2).

We then create variables for the first letter and last letter of the string using the substring method of the String class (lines 3 – 4).

Line 5 looks to see if the Boolean is true. If it is, we return the value of the variable for the first letter of the string (line 6). Otherwise, we return the value of the variable for the last letter of the string (line 8).

## Coding Bat – or35

This exercise requires that the program return the value of true if the given number is evenly divisible by either 3 or 5. The instructions encourage us to utilize modulus division to solve this problem.

As a reminder, modulus division is the “remainder” after you solve a division problem.

```public boolean or35(int n) {

}```

As you can see, we have a single integer variable named “n”.

```public boolean or35(int n) {
return (n % 3 == 0) || (n % 5 == 0);
}```

The provided solution does not utilize variables beyond the single provided n.

```public boolean or35(int n) {
double modFive = n % 5;
double modThree = n % 3;
if (modFive == 0 || modThree == 0){
return true;
}
return false;
}```

An alternative solution could use variables for the division and inside the conditional statements.

## League Meet #2 – Lessons Learned

We had our second league meet of the 2016/2017 season yesterday at the Ben Barber Career & Technology Academy in Mansfield, TX.

Team 11242 and our robot (Rufus) performed very well.

At the start of the meet, we were in 2nd place in the standings after only 1 league meet completed. At the end of the day, we slid to 3rd place for the season. However, we were tied with FTC Team 127 (Fighting Pickles) for qualifier points. Ultimately, the ranking points had to be used to break the tie – giving FTC 127 2nd place and FTC 11242 3rd place.

This meet was good as we got to see all 8 teams within the league. At the first league meet, 2 teams were unable to attend and 1 team had to forfeit at the event due to circumstances beyond their control.

###### Lessons Learned as an Event Coordinator
• Do not generate the qualifier schedule until robot inspection is completed
• We had 1 team (FTC 9582) who did not pass robot inspection but the schedule was already created and the first round of the contest already completed.
• In this case, the team was allowed to compete, but had to remain powered-down and parked. They were “dead weight” for their alliance partners. However, they benefitted from having several strong alliance partners and did not finish in last place.
• Do not change the order of the qualifier schedule once it’s compiled.
• We had a few teams who wanted to make some last-minute adjustments to their robots before being called into the queueing area, where they are not allowed to make any changes to the robot. They asked if their rounds could be moved.
• Once teams receive the qualifier schedule, they start staging resources based upon that schedule. For example, a team may choose to weight to do a quick repair on their robot knowing they are about to be off for a round or two and can move back to their pit.
• A large screen for displaying the timers and scores is needed.
• When we hosted the first league meet, we had this on a 21 inch monitor. This was too small.
• I am going to secure a large projector screen and a projector for the league tournament.
• The event coordinator does NOT need to be the emcee as well.
• There are too many things going on at a tournament or meet that the event coordinator needs to manage and emcee duties can hinder this.
###### Lessons Learned in Regards to the Robot (from Students)
• Watch for penalties! Use the timers when testing the robot in simulations.
• We were hit with 2 major penalties during the day for crossing the center line of the field during the autonomous period before the first 10 seconds.
• The first penalty would not have made a difference in winning or losing as we would have lost by 70 points as opposed to 110 points.
• The second penalty made a H-U-G-E difference in the day. As opposed to losing by 20 points, we would have won by 20 points. In that round, we against the team we ultimately were tied with in the qualifier points tally. Had we not had that penalty, we would have finished the day in 1st place and been solidly in 2nd place for the season standings.
• Don’t overcomplicate the game.
• We have spent the majority of the season trying to determine how to effectively hit the button on the assigned half of the beacon during the autonomous period.
• We realized the rules allow for an infinite number of button pushes during the autonomous mode.
• So, we can drive up and just hit the beacon regardless of which button we hit or color we are assigned. We have a 50/50 shot of getting the correct color.
• At this point, the color sensor will determine if the beacon is the correct color. If it is, we move on to the second beacon. If is isn’t we wait 5 seconds and just ram the beacon again. This will toggle the beacon to the other color.
• If we have to change the color of the beacon, we’ll make sure to build in a check to verify the color before we move on to the second beacon.
• A launcher for autonomous can’t be that hard to build.
• We’ve been struggling to build a reliable intake and launching system for the small particles used in the game this year.
• We’ve decided to just build a launcher. This will allow us to load 1 or 2 particles during autonomous to score points.
• We’ll use a servo to push the balls into the correct position to be caught by the launching wheels.
• These launches will occur at the start of the autonomous period while we are waiting to make sure we don’t get any penalties.
• Servos stink at pushing beacon buttons.
• The original design had called for servos to extend an actuator to push the beacon buttons.
• Unfortunately, the beacon buttons are just a below the height of the game floor walls. As such, the actuator can actually get snagged on the wall.
• When trying to break free, the servo horn is the weakest point in the system and typically fails. We have now lost two servos this way.
###### Lessons Learned in Regards to the Team (from Coach)
• FTC 11242 is an outstanding team!
• Our programming captain takes charge and can make on the fly changes to the program!
• Our design and mechanical captain gets everything done on the robot that needs to be done and keeps us operational!
• Our driver did an awesome job! He even saved another team who had gotten stuck on the base of the center vortex!
• The members of the team support each other and showed the best of what Ferris has. I am very proud to be their coach!

## League Meet #2 Matches

Here are the raw videos of the matches FTC11242 (ERROR 404) competed in at League Meet #2 earlier today.

Match 1 of 511242/9608 (BLUE) vs 11085/127 (RED)
WINNER: RED (141 to 35)

Match 2 of 59608/9402 (BLUE) vs 9582/11242 (RED)
WINNER: RED (60 to 10)

Match 3 of 59402/11242 (BLUE) vs 127/9609 (RED)
WINNER: RED (80 to 61)

Match 4 of 511242/11085 (BLUE) vs 9402/9402 (RED)
Winner: BLUE (76 to 15)

Match 5 of 59582/127 (BLUE) vs 11242/9403 (RED)
Winner: BLUE (90 to 40)

## Coding Bat – Cluster 1

Today, while I was working with the FTC 11242 (ERROR 404) robotics team at Ferris Intermediate School for our community outreach efforts, my Computer Science class was assigned to complete 4 different Coding Bat assignments.

#### Coding Bat – helloName

This exercise requires that the program return an entered name with the word Hello appended to the front and an exclamation point following the name.

```public String helloName(String name) {

}```

```public String helloName(String name) {
return "Hello " + name + "!";
}```

The solution above simply uses the concatenate function to append “Hello ” in front of the name variable and the “!” following it.

#### Coding Bat – makeAbba

This exercise requires that the program take two input strings of text and place them into the A-B-B-A order.

For example, let’s say that string A is “cat” and string B is “dog”. The output would be catdogdogcat.

```public String makeAbba(String a, String b) {

}```

```public String makeAbba(String a, String b) {
return a + b + b + a;
}```

The solution above simply uses the concatenate function to append variable a to variable b to variable b to variable a.

#### Coding Bat – makeTags

This exercise requires that the program take two entered strings of which the first is an HTML tag and create a formatted HTML instruction with open and closing tags enclosing the second entered string.

```public String makeTags(String tag, String word) {

}```

```public String makeTags(String tag, String word) {
return "<" + tag + ">" + word + "</" + tag + ">";
}```

The solution above simply uses the concatenate function to append the correct text and variables in an HTML syntax structure.

#### Coding Bat – withoutX

This exercise requires that the program take an entered string that if it start with or ends with “x” the “x” is removed. If there is an “x” in the middle of the letter, it remains.

```public String withoutX(String str) {

}```

As you can see, we have a string variable named str.

```public String withoutX(String str) {
int count = str.length();
if (count == 0){
return str;
}
int secondToLastLetter = count - 1;
String firstLetter = str.substring(0, 1);
String lastLetter = str.substring(secondToLastLetter, count);
if (str.equals("x")){
str = "";
}
else if (firstLetter.equals("x") && (lastLetter.equals("x"))){
str = str.substring(1,secondToLastLetter);
}
else if (firstLetter.equals("x")){
str = str.substring(1,count);
}
else if (lastLetter.equals("x")){
str = str.substring(0,secondToLastLetter);
}
return str;
}```

You can see that this problem was little bit more involved because the testing data set included an empty string and a string that was just a single letter x.

Lines 3 – 5 address the situation of a null or empty string.

Lines 6 – 8 create local variables to be used in the other cases presented.

Lines 9 – 11 address the situation of only the letter x.

Lines 12 – 14 address the situation of an x at the front AND an x at the end.

Lines 15 – 17 address the situation of an x only at the front.

Lines 18 – 20 address the situation of an x only at the end.

Line 21 returns what the string will look like with the necessary letter x’s removed.

## Coding Bat – in3050

This exercise requires that the program return the value of true if both of two numbers entered are between 30 and 40 (inclusive) or between 40 and 50 inclusive.

```public boolean in3050(int a, int b) {

}```

As you can see, we have two integer variables named “a” and “b”.

```public boolean in3050(int a, int b) {
if (a >= 30 && a <= 40 && b >= 30 && b <= 40) {
return true;
}
if (a >= 40 && a <= 50 && b >= 40 && b <= 50) {
return true;
}
return false;
}```

In the solution provided, we have a Boolean that returns true if A is any of the following values:

30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40

AND if B is any of the following values:

30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40

We have a second conditional statement that returns true if A is any of the following values:

40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50

AND if B is any of the following values:

40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50

Otherwise, a false is returned.

An alternate solution could also be:

```public boolean in3050(int a, int b) {
if ((a >= 30 && a <= 40 && b >= 30 && b <= 40) || (a >= 40 && a <= 50 && b >= 40 && b <= 50)) {
return true;
}
return false;
}```

Here, we have combined the else if portion of the original solution into a BOOLEAN or statement.

## Coding Bat – loneTeen

This exercise requires that the program return the value of true if either of two numbers entered is a teen (13 through 19). If both are teens, the program is to return the value of false.

```public boolean loneTeen(int a, int b) {

}```

As you can see, we have two integer variables named “a” and “b”.

```public boolean loneTeen(int a, int b) {
boolean aNotTeen = (a < 13 || a > 19);
boolean bNotTeen = (b < 13 || b > 19);

return (aNotTeen && !bNotTeen) || (!aNotTeen && bNotTeen);
}```

In the solution, we first created a boolean named “aNotTeen” which returns a value of true if the value of integer “a” is less than 13 OR greater than 19.

We continued by creating a second boolean named “bNotTeen” which returns a value of true if the value of integer “b” is less than 13 OR greater than 19.

Finally, we have the application return the boolean of aNotTeen AND NOT bNotTeen OR the boolean of NOT aNotTeen AND bNotTeen.

Let’s look at what happens if “a” is 12 and “b” is 17:

• aNotTeen = TRUE
• bNotTeen = FALSE

So, in the return we have (TRUE && NOT FALSE) || (NOT TRUE && FALSE). As TRUE and NOT FALSE are one and the same and NOT TRUE and FALSE are one and the same, this returns as TRUE.

Let’s look at what happens if “a” is 13 and “b” is 17:

• aNotTeen = FALSE
• bNotTeen = FALSE

On the return, we get (FALSE && NOT FALSE) || (NOT FALSE && FALSE). As FALSE and NOT FALSE are opposites, this returns as FALSE.

Coding Bat provides a slightly different solution which is built around whether the integer is a teen.

```public boolean loneTeen(int a, int b) {
boolean aTeen = (a >= 13 && a <= 19);
boolean bTeen = (b >= 13 && b <= 19);

return (aTeen && !bTeen) || (!aTeen && bTeen);
}```

As you can see, their solution is just as elegant as the solution provided above, but just tackles the problem in a different manner.

Using the examples from above of a = 12 and b = 17:

• aTeen = FALSE
• bTeen = TRUE

On the return, we get (FALSE && NOT TRUE) OR (NOT FALSE and TRUE).

As both of those are the same, it returns as TRUE. You’ll notice that it works backwards from my return since my boolean is working opposite to their solution.

## Coding Bat – icyHot

This exercise requires that the program return the value of true if one of two temperatures entered is less than 0 and the other is greater than 100.

```public boolean icyHot(int temp1, int temp2) {

}```

As you can see, we have two integer variables named “temp1” and “temp2”.

```public boolean icyHot(int temp1, int temp2) {
return ((temp1 < 0 && temp2 > 100) || (temp1 > 100 && temp2 < 0));
}```

In the solution, we return a boolean for “temp1” is less than 0 AND “temp2” greater than 100 OR “temp1” is greater than 100 AND “temp2” is less than 0.

Let’s look at the following test data:

• temp1 = -5
• temp2 = 105

On the return, we have (TRUE && TRUE) OR (FALSE && FALSE). This will return as TRUE.

Let’s now look at another set of test data:

• temp1 = 5
• temp2 = 105

On the return, we have (FALSE && TRUE) OR (FALSE && FALSE). This will return as FALSE.

Finally, let’s look the this final set of test data:

• temp1 = 5
• temp2 = 95

On the return, we have (FALSE && FALSE) OR (FALSE && FALSE). This will return as FALSE.

## A Personal and Professional Challenge

Back in September 2015, I had the privilege of speaking with the mother of one my students who challenged me professionally and personally. Unknown to me at the time I dialed the phone, she had just returned minutes earlier from a visit with an oncologist who had told her that she would likely not survive to the summer.

She had asked me to call her about the performance of her son in my 4th grade math class for the first six-weeks. A minute or two into our phone call, she broke down and asked if she had raised a good boy. She then told me the life-changing news she had just received and that they were not telling their son at this time the severity of her illness.

While she was understandably upset at the news she had received, she just wanted reassurance that she had raised a good boy who had a good start to being a fine and upstanding man.

I told her the full truth about her son and assured her that he was a very caring and energetic 4th grader who looked for the interests of his classmates. I told her that she had done an outstanding job raising him and that I felt that he had a solid foundation to develop into the man she wanted him to become.

Since entering education in 2002 and after countless parent phone calls over those years, that call was the most challenging for me both personally and professionally.

Earlier today, I received word that Viki Sprabary lost her battle to cancer on December 31, 2016. She fought back against the disease that ultimately took her and was able to see her son finish 4th grade and the first-half of 5th grade.

I am extremely honored to have known this family.