Create a static member in your class which is a bool type 2D array (call it say,current_pos) of 8X8 elements.
Each time you assign a Position to the object, be sure to mark the current_pos[x][y]=TRUE;
So, now you can keep track of what all postition are been ocupied.
Hence, as soon as your random() generates a new position, check whether that position is already occupied or not. If it is, tell him to generate another number and so on.
Since the array will be a static member, its value will be same for all the object of the class.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140