Forum > Programming
Lua Eight Queens Program
DarthTyrael:
Yeah exactly... Let me correct myself then.
If result = false it will loop the isplaceok again for a different i.
If all i's are used, it will move to the next column (c+1)
If result = true it will add the column number (c) to the n-th place in table a. then, it will move to placing the next queen (n+1), resetting the column count.
Reason this makes sense: you cannot place the queen in the same column, or they can attack each other.
America:
--- Quote from: DarthTyrael on September 01, 2016, 18:05:47 ---Yeah exactly... Let me correct myself then.
If result = false it will loop the isplaceok again for a different i.
If all i's are used, it will move to the next column (c+1)
If result = true it will add the column number (c) to the n-th place in table a. then, it will move to placing the next queen (n+1), resetting the column count.
Reason this makes sense: you cannot place the queen in the same column, or they can attack each other.
--- End quote ---
I get it now, thanks for your help
Navigation
[0] Message Index
[*] Previous page
Go to full version