(Not included in summary comparisons)
An adaptation of [pdf 100KB] "Chameneos, a Concurrency Game for Java, Ada and Others" (which includes example implementations in Java, Ada and C).
Use OS threads or the language implementation pre-emptive lightweight threads.
As a practical matter, continuations & coroutines & cooperative threading will not be accepted.
Please don't implement your own custom "custom scheduler" or use "continuations" or "coroutines" or "cooperative threading" - they will not be accepted.
How to implement
We ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.
Each program should:
create differently coloured (blue, red, yellow), differently named, concurrent chameneos creatures
each creature will repeatedly go to the meeting place and meet, or wait to meet, another chameneos "(at the request the caller does not know whether another chameneos is already present or not, neither if there will be one in some future)"
both creatures will change colour to complement the colour of the chameneos that they met - don't use arithmetic to complement the colour, use if-else or switch/case or pattern-match
write all the colour changes for blue red and yellow creatures, using the colour complement function
for rendezvouses with an odd number of creatures (blue red yellow) and with an even number of creatures (blue red yellow red yellow blue red yellow red blue)
write the colours the creatures start with
after N meetings have taken place, for each creature write the number of creatures met and spell out the number of times the creature met a creature with the same name (should be zero)
spell out the sum of the number of creatures met (should be 2N)
ndiff -fields 2-10 program output N = 600 with this output file to check your program output has the correct format, before you contribute your program.
Use a larger command line argument (6000000) to check program performance.