I'm trying to learn more about OO and classes and I thought it would be fun to do something with Visual representation so I thought to make a 10x10 grid with 1 or more "bacterias" that would move around the grid and bounce on the walls or attack or flee from other bacterias depending on how agressive they are...
I have some problem with the design though since I cannot figure out how to get the objects to interact:
So far I thought I would make a class for the grid with params x and y so I can create boards with different sizes.
The other class would be the bacteria with some different vars such as x and y position, direction (only up, down, left, right) and speed
however I also want a function like look where the "bacteria" collect information from the board object about what is in the Square above, below and to the sides of the bacteria).
How would I go about to create something like this?
(I know I could probably feed the information from the board to the bacteria everytime the bacteria move but is there a way for the object bacteria to request this information from the boardobject? (like if the bacteria can do 10 different things look, move, stay, hide...) but only one action per turn... I could feed the object bacteria with all info required all the time and only use the info i need every turn within the bacteria class... but I would rather have the bacteria to "ask the board" for only the specific info I want.
I'm not asking for full code just how I would do this in theory or even if it is possible.
Links to how objects interface with eachother would also be appreciated since I don't know what to search for.
Thanks