Hi to everyone...
I am told to code a Schelling's Segregation Model simulation in C++ . This is about agent simulation and let me explain shortly what it is wanted:
* There is a place like the chessboard (8*8)
* there are 2 kind of people , the X and the O
* place randomly 20 X and 20 O , with no overlapping.
* there is no runaway from the board. (i mean, at the end, still will be 40 people and 24 empty cells.
* Then you should move someone to somewhere randomly, that at least there will be 3 agents with the same type (x or O).
* I mean, a agent will be happy if it has at least 2 neighnours. else, it will change its position till it can found a place with at least 2 other neighbours.
* the program will just run and print to a file.
I coded nearly all the needed things, but confused what to do next when i come to deciding of the moving process.
Now, I look at the  th cell, if there is an agent there, then I look to its neighbours. just like Linked lists, a data called m_pNext is used in the class of agent. It will mimic like list, and will show its next agent. I set something to next, but i dont know how i will decide this for all of the agents.
plz give me a way about this confusion. Which way can be the sortest?
I run this code in mingw developer studio, known as a g++ compiler.
code is attached, and one result text file.