its in java, sorry guys. this is for a java class im taking
i ask here other than anywhere else cause its been proven that people here know their $$$$
Code:
class DorinsMethods{
//c1 < c2 pts wise...
public static int cost(int n,int c1,int r1,int c2,int r2)
throws IllegalArgumentException {
//if(c1 < 1 || c1 > 10 || c2 < 1 || c2 > 10 ||
// r1 < 1 || r1 > 10 || r2 < 1 || r2 > 10)
// return 0;
return n + (r2-r1);
}
}
public class Checker{
static int bounds = 0;
public static void main(String args[]){
//error checking
try{
bounds = Integer.parseInt(args[0]);
}
catch (Exception e) {
System.out.println("Usage is: SlidingCheckers <number>");
System.exit(1);
}
//end error checking
System.out.println(DorinsMethods.cost(4, 3, 4, 4, 5));
bestof(bounds, bounds-2);
}
public static int solve(int row, int col) {
}
public static int max(int arg1, int arg2, int arg3) {
int temp = Math.max(arg1, arg2);
return Math.max(temp, arg3);
}
public static int bettermove(int row, int col){
int answer1 = -99999, answer2 = -99999, answer3 = -99999;
if(col-1 > 0){
answer1 = DorinsMethods.cost(row-1, col-1, row-1, col, row);
}
answer2 = DorinsMethods.cost(row-1, col, row-1, col, row);
if(col + 1 < 11){
answer3 = DorinsMethods.cost(row-1, col+1, row-1, col, row);
}
int fanswer = max(answer1,answer2,answer3);
if(fanswer == answer1)
return col-1;
if(fanswer == answer2)
return col;
if(fanswer == answer3)
return col+1;
}
}