Courses‎ > ‎AP Computer Science‎ > ‎Konstantinovich‎ > ‎

notes

2018-01-19

posted Jan 19, 2018, 5:58 AM by Konstantinovich Samuel   [ updated Jan 19, 2018, 5:58 AM ]

Please Fill this form out:

2018-01-17

posted Jan 17, 2018, 6:11 AM by Konstantinovich Samuel   [ updated Jan 18, 2018, 9:34 AM ]

Final Exam Time: 12:00-1:40pm
Final Exam Rooms:
p9 ----- 337
p10 ----- 339

There will be a survey to take on Thursday or Friday. You MUST complete it even if you are absent. 

2018-01-11

posted Jan 11, 2018, 5:38 AM by Konstantinovich Samuel   [ updated Jan 12, 2018, 11:48 AM ]

Jan 16th 8am: Demo Version 
Jan 16th - 19th Demos
Jan 19th Modified Prototype Due (all the handwritten changes etc.) 
Jan 22nd Final Exam 12pm-1:40pm  DO NOT BE LATE!!!!
            +  FInal Project Last Commit (8am  on the 22nd)

2018-01-08

posted Jan 8, 2018, 5:48 AM by Konstantinovich Samuel

Better branching tutorial:
https://www.atlassian.com/git/tutorials/using-branches

Suggestion: use rebase instead of merge. 


Overall:
Don't forget to commit and push branches before merging/rebasing.


2018-01-03

posted Jan 3, 2018, 6:01 AM by Konstantinovich Samuel

Prototypes:
    Hand in, stapled. 
Github:
    Branching is your friend.
    Try this to start:  https://learngitbranching.js.org

Work on final projects.

YOU MUST LET ME KNOW AS SOON AS YOU HAVE ISSUES.
    -I will prioritize feedback on groups that feel they don't know how to organize/start/etc.


    

2018-01-02

posted Jan 2, 2018, 6:13 AM by Konstantinovich Samuel   [ updated Jan 3, 2018, 9:59 AM ]

Goal: Discussion of testing methodology and when you are "Finished" with an assignment. 
Goal2: Understanding that we often solve problems in some simple/hacky way. 


public static void runTest01(int testID){
  if(testID<0){
    System.out.println("Error in driver usage!");
    System.exit(0);
  }
  
  SuperArray s1 = new SuperArray();
  ArrayList<String> s2 = new ArrayList<>();
  
  try{
    if(testID == 0 ){
    }
    
    if(testID == 1 ){
      s1.add("0");
      s2.add("0");
      s1.add("1");
      s2.add("1");
    }
    
    if(testID == 2 ){
      
      s1.add("0");
      s2.add("0");
      s1.add("1");
      s2.add("1");
      s1.add(1,"5");
      s2.add(1,"5");
      s1.add(0,"6");
      s2.add(0,"6");
      s1.add(s1.size()-1,"4");
      s2.add(s2.size()-1,"4");
    }
    
    if(testID == 3 ){
      s1.add("0");
      s2.add("0");
      s1.add("1");
      s2.add("1");
      s1.add(1,"5");
      s2.add(1,"5");
      s1.add(0,"6");
      s2.add(0,"6");
      s1.add(s1.size(),"4");
      s2.add(s2.size(),"4");
    }
    
    if(testID == 4 ){
      s1.add(0,"0");
      s2.add(0,"0");
    }
    
    if(testID == 5 ){
      s1.add("1");
      s2.add("1");
      for(int i = 0; i < 10; i ++){
        String v = ""+(int)(Math.random()*1000);
        int in = (int)(Math.random()*s2.size());
        s1.add(in,v);
        s2.add(in,v);
      }
    }
    
    if(testID == 6 ){
      try{
        s1.get(0);
      } catch(IndexOutOfBoundsException e){
        
      }
    }
    
    if(testID == 7 ){
      try{
        s1.set(0,"");
      } catch(IndexOutOfBoundsException e){
        
      }
    }
    
    if(testID == 8 ){
      try{
        s1.add(1,"");
      } catch(IndexOutOfBoundsException e){
        
      }
    }
    if(testID == 9 ){
      s1.add("1");
      s2.add("1");
      
      for(int i = 0; i < 1000;   i ++){
        String v = ""+(int)(Math.random()*1000);
        int in = (int)(Math.random()*s2.size());
        s1.add(in,v);
        s2.add(in,v);
      }
    }
    
    
  }catch(Exception f){
    s2.add("0");
    //f.printStackTrace();
  }
  
  if(equals(s1,s2)){
    System.out.println("Test "+testID+",PASS");
  }else{
    System.out.println("Test "+testID+",FAIL");
  }
  
  
  
}

//oops! forgot this
public static boolean equals(SuperArray s, ArrayList<String> a){
    if(s.size() == a.size()){
      for(int i = 0; i < s.size(); i++){
        if(! s.get(i).equals( a.get(i))){
return false; } } return true; } return false; }







public static void runTest02(int testID){
  
  if(testID<0){
    System.out.println("Error in driver usage!");
    System.exit(0);
  }
  
  OrderedSuperArray s1 = new OrderedSuperArray();
  ArrayList<String> s2 = new ArrayList<>();
  
  try{
    if(testID == 0 ){
    }
    
    if(testID == 1 ){
      s1.add("4");
      s2.add("4");
      s1.add("1");
      s2.add("1");
      s1.add("0");
      s2.add("0");
    }
    
    if(testID == 2 ){
      s1.add("3");
      s2.add("3");
      s1.add("1");
      s2.add("1");
      s1.add("5");
      s2.add("5");
      s1.add("0");
      s2.add("0");
    }
    
    if(testID == 3 ){
      s1.add("1");
      s2.add("1");
      for(int i = 0; i < 10; i ++){
        String v = ""+(int)(Math.random()*1000);
        int in = (int)(Math.random()*s2.size());
        s1.add(in,v);
        s2.add(in,v);
      }
    }
    
    if(testID == 4 ){
      s1.add("1");
      s2.add("1");
      try{
        s1.set(0,"");
      } catch(UnsupportedOperationException e){
        
      }
    }
    
    if(testID == 5 ){
      try{
        s1.set(0,"");
      } catch(UnsupportedOperationException e){
        
      }
    }
    
    if(testID == 6 ){
      String[] x= {"adsf","b","X","C","fish","cat","Abby","break","romp"};
      s1 = new OrderedSuperArray(x);
      s2.addAll(Arrays.asList(x));
    }
    if(testID == 7 ){
      s1.add("1");
      s2.add("1");
      
      for(int i = 0; i < 1000;   i ++){
        String v = ""+(int)(Math.random()*1000);
        s1.add(v);
        s2.add(v);
      }
    }
    
    
  }catch(Exception f){
    s2.add("0");
    //f.printStackTrace();
  }
  
  Collections.sort(s2);
  if(equals(s1,s2)){
    System.out.println("Test "+testID+",PASS");
  }else{
    System.out.println("Test "+testID+",FAIL!");// "+s1+"!="+s2);
  }
}


//oops!
public static boolean equals(OrderedSuperArray s, ArrayList<String> a){
    if(s.size() == a.size()){
      for(int i = 0; i < s.size(); i++){
        if(!s.get(i).equals( a.get(i))){
          return false;
        }
      }
      return true;
    }
    return false;
  }



//Tested your sorts on:
// - size 0, size 1 (mode doesn't matter)
// - size 1000 in all 3 modes for all 3 sorts

//SORT: 0=Bubble, 1=Selection, 2=Insertion
//MODE: 0=Increasing, 1=Decreasing, 2= randomized
//SIZE: Size of array
public static void runTest08(int SORT, int SIZE, int MODE){
  //This is super ugly, I repurposed old code
  //Sorry!
  int[]inc = new int[SIZE];
  int[]dec = new int[SIZE];
  int[]rnd = new int[SIZE];
  int[][] arrays = new int [6][];
  
  for(int i = 0; i < inc.length; i ++){
    inc[i] = -10000 + 10 * i + (int)(Math.random()*5);
    dec[SIZE-i-1] = inc[i];
    rnd[i] = (int)(Math.random() * 20000000)-10000000;
  }
  arrays[3]= inc;
  arrays[4]= dec;
  arrays[5]= rnd;
  arrays[0]=Arrays.copyOf(inc,SIZE);
  arrays[1]=Arrays.copyOf(dec,SIZE);
  arrays[2]=Arrays.copyOf(rnd,SIZE);
  Arrays.sort(inc);
  Arrays.sort(dec);
  Arrays.sort(rnd);
  
  sort(arrays[MODE],SORT);
  
  if( ! Arrays.equals(arrays[MODE+3],arrays[MODE]) ) {
    System.out.println("FAIL! "+methodName(SORT)+" Mode:"+MODE+" Size:"+SIZE);
  }else{
    System.out.println("PASS! "+methodName(SORT)+" Mode:"+MODE+" Size:"+SIZE);
  }
}

public static void sort(int[]ary,int method){
  try{
    if(method == 0){
      Sorts.bubbleSort(ary);
    }
    if(method == 1){
      Sorts.selectionSort(ary);
    }
    if(method == 2){
      Sorts.insertionSort(ary);
    }
  }catch ( Exception e){
    e.printStackTrace();
  }
}
public static String methodName(int i){
  String[]names = {"Bubble","Selection","Insertion","Built In"};
  return names[i];
}

2017-12-22

posted Dec 22, 2017, 10:18 AM by Samuel Konstantinovich

Goal:)

Go over sorts.


Single run Comparison: (40k, 4th array)


Multiple run Comparison: (40k, Average of 4 array times)

2017-12-21

posted Dec 21, 2017, 9:57 AM by Konstantinovich Samuel   [ updated Dec 21, 2017, 10:16 AM ]

Goal:
Verify your sorts!

Download and use the benchmark on your Sorts.java.
I may have spelled the sort calls differently because I forgot my laptop and am using an old version of Sorts.java.


This requires your sorting algorithms to work.
Run it twice:
java Benchmark 10000
java Benchmark 40000

SAMPLE:

user@host $ java benchmark 10000
Increasing,Decreasing,Random,RandomFewValues
Bubble:
95,193,426,412,
Selection:
91,246,195,194,
Insertion:
1,112,55,42,
Built In:
0,1,4,0,

user@host $

Copy the numbers into The Big Sorting Sheet:

You would add the numbers to the sheet in the same order they appear!
e.g.
95,193,426,412,91,246,195,194,1,112,55,42,0,1,4,0

IF ONE OF YOUR SORTS FAILS : LEAVE THE NUMBERS BLANK!
DO NOT ADD ANY NUMBERS FOR FAILED SORTS





2017-12-19

posted Dec 19, 2017, 9:17 AM by Samuel Konstantinovich

Give Back Quizzes.
Go Over Proposals.
Go Over Practice Final.


2017-10-18

posted Dec 18, 2017, 9:34 AM by Konstantinovich Samuel   [ updated Dec 19, 2017, 9:12 AM by Samuel Konstantinovich ]

Dates:
Jan 3rd in class: Prototype due + First Commits
Jan 16th 8am: Demo Commit. You must make a branch called Demo (discussion later!)
Jan 16th - 19th Demos
Jan 22nd - Final Commit, Your main branch 

-Final Project Lab time: (3 days + 5 days)  Minus a couple of mini-lectures, and 1 quiz. 
    3th-5th lab time
    8th-12th lab time
-The last 4 days of class are demos. You do not get class time. 
    16th-19th demos
    I will ask you to change to your demo branch for this!


Regarding final projects:
The following things will NEVER hurt your grade, but can help you get your project done. Please let me know RIGHT AWAY if:
    -your partner is non-cooperative, you cannot work together effectively.
    -you and your partner cannot resolve a disagreement.
    -you are stuck on something



Prototype:
Deadline: Wed after you get back from break, it can be updated afterward, but I want to see that you have it. 

NO CODE: Until you hand in the prototype there should be absolutely NO CODE! This is a design process. 
You can experiment with different NetLogo features and try making mini-models as a 'working prototype' but nothing you do before the official start counts. 


Grade: This will be 20% of your final project grade. It should look like you put serious effort into it. 
If it looks like you did this assignment on the train coming to school or rushed it the night before, I will grade you accordingly. 
Diagrams can be printed images, or hand drawn. Both of you should PROOFREAD the entire document.


Hand drawn does not mean you can draw like a 5-year-old.
    -Take time to draw what you want to show. You don't have to draw everything (just the world, or include the buttons as you choose.)
    -Use a ruler for straight edges! This makes it look much better. (No ruler = you didn't care)
    -Please use reasonable paper! (Drawing on wrinkled looseleaf = you didn't care)
  

The purpose of the document is to:
   a. Come together with your partner and make a clear picture of what you BOTH want to do. 
   b. Explicitly describe the behavior of your project so I can tell you if there are potential problems. 
   c. Make clear expectations public so you have guidelines to follow and don't cut features for no reason.
   d. Have the document in class when you are working so I can reference it when I see your group.

The 2nd page (and onwards) is SUPER important
Development Stages
    -A timeline of features to be added, prioritized by importance and feasibility.
    -It is ok to fall behind schedule. 
    -It is OK to modify this.

Drawings include UML diagrams! 
    This is most important for a java based project.


Keep it out in class:
    -Print one for me, and one for each of you. 
    -You must have it out at all times.

Evolving document:
    -You may ADD to it, but do NOT remove old pages. 
    -You may mark sections as outdated, and that they are replaced later. 
    -The goal is to see the evolution of your project over the 2 weeks. 


Prototype Format Document has a cover page format, but the rest is not a sample. The rest details what should be in the prototype. 
https://www.dropbox.com/s/x4xcomc9poc28xg/Prototype.pdf?dl=1

1-10 of 65