package codingbat.logic2;

/*
 * We want to make a row of bricks that is goal inches long.
 * We have a number of small bricks (1 inch each) 
 * and big bricks (5 inches each). 
 * Return true if it is possible to make the goal by choosing 
 * from the given bricks. 
 * This is a little harder than it looks and can be done without any loops. 
 * See also: Introduction to MakeBricks 
 * 
 * makeBricks(3, 1, 8) = true
 * makeBricks(3, 1, 9) = false
 * makeBricks(3, 2, 10) = true
 */

public class MakeBricksTest {

  public static void main(String[] args) {
    MakeBricksTest test = new MakeBricksTest();

    System.out.println(">" + test.makeBricks(3, 1, 8) + "<");
    System.out.println(">" + test.makeBricks(3, 1, 9) + "<");
    System.out.println(">" + test.makeBricks(3, 2, 10) + "<");
  }

  public boolean makeBricks(int small, int big, int goal) {
//    if (goal == small || big*5 == goal) {
//      return true;
//    }
//    else if (small + (big*5) < goal) {
//      return false;
//    }
//    
//    
    return false;
  }

}

@@ -859,54 +859,62 @@
 ) %7B%0A
-//
     i
-f (goal == small %7C%7C big*5 == goal
+nt inchBig = big*5;%0A    %0A    if (inchBig == 0
 ) %7B%0A
-//
     
@@ -926,32 +926,37 @@
 urn 
-true;%0A//
+goal %3C= small;%0A
     %7D%0A
-//
     
-else
+%0A   
  if 
@@ -968,15 +968,15 @@
 l + 
-(big*5)
+inchBig
  %3C g
@@ -982,18 +982,16 @@
 goal) %7B%0A
-//
       re
@@ -1006,25 +1006,139 @@
 se;%0A
-//
+    %7D%0A    %0A    while (goal%25inchBig == goal) %7B%0A      inchBig -= 5;%0A
     %7D%0A
-//
+%0A
     
-%0A//
+if (goal%25inchBig %3C= small) %7B%0A      return true;%0A    %7D%0A
     

add makeBricks task