hello
i am try to create crossWord generator and i have javascript sourc code but i have encountered problem
i want to convert this code to as3
for(var r = row + 1, c = col, i = 0; r < grid.length && c < col + word.length; c++, i++){
var is_empty = grid[r][c] == null;
var is_intersection = grid[row][c] != null && grid[row][c][‘char’] == word.charAt(i);
var can_place_here = is_empty || is_intersection;
if(!can_place_here) return false;
}
// check to make sure we aren’t overlapping a char (that doesn’t match)
// and get the count of intersections
for(var c = col, i = 0; c < col + word.length; c++, i++){
var result = canPlaceCharAt(word.charAt(i), row, c);
if(result === false) return false;
intersections += result;
}
sorry for my bad english
I’ve never seen that either.(or maybe I forgot it?)
Its a bit more involved than just a single loop. Its possible to make a nested loop with just a single for loop for example.
I think it was interesting. Like this for example…
for (var i = 0,j = 0; i < 4 && j < 4; i++) {
if (i % 4 == 0) {
i=0;
j++;
}
trace(i + " " + j);
}