Working on a program called Tank Wars. Does this look recursive. Thanks.
public Vector%26lt;location%26gt; get_line (location from, location to)
{
Vector%26lt;location%26gt; L = new Vector%26lt;location%26gt;();
Random gen= new Random(); // setting Random to choose spots on 52x72 grid
from.r = Math.abs(from.r-to.r);
from.c = Math.abs (from.c-to.c);
// board_rows = 52 size of the map
// board_cols = 72 size of the map
from.r =gen.nextInt (52); // Restricting within grid
from.c =gen.nextInt (72);
System.out.println("Row: " + from.r + " Col: " + from.c);
return L ; // returning variable
}
public boolean vertical(location from, location to)
{
Random gen= new Random(); // setting Random to choose spots on 52x72 grid
if (gen.nextInt(2)%26lt;1) return false;
else return true;
}
Need help with recursion in Java :(?
No, recursion is when a function calls itself. Here's a page that explains it:
http://danzig.jct.ac.il/java_class/recur...
Reply:where is the recursion?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment