Task: You will implement an app that uses threads and concurrent computation. Your task to simulate a social network. The main program should spawn num_ants
number of threads, and each of these threads model an Ant (user) in the social network. The Ants should then (at random intervals) choose one of the other Ants (at random) and send a random message to that Ant.
- Your project should define an appropriate data type Ant, which should include their username, and a Message type to keep track of messages between ants.
- Your project should also contain a main thread which creates
num_ants
"ants" (num_ants
values of type Ant), and spawnsnum_ants
threads, one for each of these ants. - Each user thread should behave as follows: at random time intervals, the thread should select one of the other ants at random, and send a random message to that ant.
- Your system should simulate
num_messages
messages, and then terminate and output the final count of how many messages each user received.