Advertisement
fistersanonymous

Untitled

Oct 31st, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.  private void scoreTree(Node curr){
  2.         int nodeChoice = 0;
  3.         Node temp = curr;
  4.         if(temp.getChildren()!= null){
  5.             for(int i = 0; i < temp.getChildren().size(); i++){
  6.                // System.out.println("loop");
  7.                 if((temp.getChildren().get(i).isLeaf())){
  8.                     if(temp.getChildren().get(i).getScore() == 1){
  9.                         temp.setScore(1);
  10.                         temp.getChildren().get(i).setScore(0);
  11.                         System.out.println(temp.getChildren().get(i).getValue());
  12.                     }
  13.                     else{
  14.                         temp.setScore(-1);
  15.                         temp.getChildren().get(i).setScore(0);
  16.                     }
  17.                 }
  18.                 scoreTree(temp.getChildren().get(i));
  19.             }
  20.         }
  21.         temp.setScore(1);
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement