Thursday, November 13, 2008

Changes in the algorithm

Before I step over to the next chapter, I'll correct some minor things that didn't work out correctly in the Algorithm.

I will only mention the things that have changes, like ...

member variables:
isRevolved array (2d)

M:revolve field, x and y given:
right at the beginning:
put the field at the revolved array to true

beginning, length, height and mine count given:
-create 2 other arrays for the flags and the revolvedInformation (if its revolved or not)

M:revolve next queue item
after the condition
<-condition: if the queue is not empty{
-call this function again (recursive)
}


You see, the main thing is that I forgot, that there has to be something, that remembers, if a revolved field IS revolved. I solved that by an additional 2d array, that has the same size as the mine array and the flag array.

The other thing was, that the revolve next queue item method didn't work properly, because it was not recursive. so when the stack has still empty fields to revolve, it should call the function again.

No comments: