Just some stupid typos. Revised is:
function squareWidth (x, y, N) {
var p = 1
var q = 1
var w1 = x
var w2 = y
var nextW1 = x/2
var nextW2 = y/2
while (true) {
var numSquares = p*q
var currWidth = Math.min(w1,w2)
if (numSquares >= N) {return currWidth}
if (nextW1>nextW2) {
p++
w1 = nextW1
nextW1 = x/(p+1)
} else {
q++
w2 = nextW2
nextW2 = y/(q+1)
}
}
}
Best
Danny
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com