
algorithm help
The question is, given an n x n checker board, and a cost function, fund the maximum value to move the checker from the bottom row to the top row. only stipulation is when you move up, you can only go to the square above you or diagnal (sp) left or right.
the cost function will basically return the cost and the inputs will be ur current row and col and the next row and col.
obviously, im not asking for the answer, but i am asking for help on where to start.
thanks

well first try finding a pattern that if moved in these series of steps you will always endup with the biggest cost....it is fairly simple if you think about it. Once you have that then its a matter of coding it.

i dont mean to sound rude, but thats kinda too vauge for me

sorry...but thats the toughest art of "algorythm development"  try it your self with a pen and paper, or a board of you have one. First find out which path gives the lowest cost  straight up. And then start finding other paths while counting. Develop a mathematical expression and you're done The pattern is real simple.

Post what you have so far. Also, whenever you have to write a program from a specification, it helps to do a 'domain analysis' of the problem first. This might state:
1) the program specification itself.
2) the specification, in your own words.
3) what you understand about the problem.
4) what you don't understand about the problem.
5) research TODO's
6) extensibility/enhancement considerations.
That will help solidify you plan of action. Throughout the development process you can add/revise to it as needed, of course. Then start by writing the program out in psuedocode  preferably using a 'topdown' approach. Next, 'stub out' the program, ie: put all of the functions in place but just have them print entry/exit messages and return dummy values. Finally, start adding the code, making sure to recompile the program often in order to tackle syntax/logical errors in managable pieces. The point is, you should always use a systematic approach when you're designing/implementing a program. It almost always turns out better than if you had just 'jumped right in'.

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 + (r2r1);
}
}
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, bounds2);
}
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(col1 > 0){
answer1 = DorinsMethods.cost(row1, col1, row1, col, row);
}
answer2 = DorinsMethods.cost(row1, col, row1, col, row);
if(col + 1 < 11){
answer3 = DorinsMethods.cost(row1, col+1, row1, col, row);
}
int fanswer = max(answer1,answer2,answer3);
if(fanswer == answer1)
return col1;
if(fanswer == answer2)
return col;
if(fanswer == answer3)
return col+1;
}
}

hmm got it (i think)
thanks peeps