Crack the Code & Win a Brand New iPhone 13


Write a programme in your preferred programming language (C, C++, Java, Erlang, Elixir, PHP, Python) to implement the following logic:

Bob and Alice are 2 friends living in 2 parallel worlds. They are playing a game called “send my time and sleep”.  As soon as the game starts, Bob sends his current time to Alice. Alice listens for incoming messages from Bob and once she receives his message, she sleeps for 5 seconds. Then she repeats (print on the screen) Bob’s message and sends her current time to Bob.

In return, Bob listens for incoming messages from Alice and once he receives her message, he sleeps for 5 seconds. He then repeats the message and sends his current time back to Alice.

The game continues until either Bob or Alice sends the “stop” message. Alice has her own channel to send these messages and this channel has features to ensure bob receives messages in FIFO order. 

Only Alice sends messages in her channel and Bob only reads Alice’s channel. Same as Alice, Bob has his own channel and the same logic applies. 

All messages they send are in Json format. E.g


  "MessageId": "1", 

  "Sender": "Alice", 

  "receiver": "Bob", 

  "CurrentTime": "10:25 15/10/2021" 


MessageId is an integer. Bob generates the first integer and each recipient increments the received Id using the following Sequence. 

1st Id = 0 

2nd Id = 1 

3rd Id and after = the sum of previous 2 Ids 

To make sure that no one else can read these messages, both Alice and Bob encrypt their messages using a shared secret. 


  • Please pay special attention to highlighted words/sentences and apply the most suitable/advanced programming/language concepts.
  • Follow the competition’s rules below to ensure your submissions are not disqualified.
  • Upload the final code to your Google drive
  • Email the sharable link to your code document on your Google drive to  “commpetition@globalwavenet.comm”
  • Deadline for submissions: From 4 PM (IST) 8th December up until, on or before 12 NOON (IST) on 09th December 2021.


  1. Only one person can submit entry (per entry)
  2. Corrected code must be the authentic work of the applicant.  
  3. To enter a competition, you must be in Sri Lanka, 18 years old or over at the time of entry. 
  4. No part of a prize is exchangeable for cash or any other prize. 
  5. If you want to enter a competition you must register on the link given and enter all details required. If you are not registered before you submit the code your entry will not be considered. 
  6. Entries must be uploaded to your Google drive and link to the document must be sent by email to the given address above. Entries sent to other email addresses will NOT be valid. If your Google drive is not provided with access to us, the entry will not be considered. So ensure you have provided the appropriate access to your Google drive when sending the link.
  7. You must use the Preferred Code that you selected during registration when submitting the code. 
  8. One entry is permitted per person. Please do not send duplicate entries for the same person and incorrectly completed entries will be disqualified. 
  9. By entering the competition, the winner agrees to give Wavenet permission to contact the participant and in promotional activity and material as Wavenet may require. 
  10. Not applicable for Wavenet staff and immediate family members. 
  11. If you are unavailable for semifinalist discussion sessions on the date agreed or if you have not provided a valid phone number your application will not be accepted, we will not be able to progress to qualify to win. 
  12. We will contact the semi finalist by phone to arrange the briefing sessions. 
  13. Winner will be contacted by phone to collect the prize from Wavenet offices at an agreed date and time. 
  14. The judges’ decision will be final, and no correspondence will be entered into.
  15. The closing date is as specified in each competition, and Wavenet reserves the right to amend the competition end date at any time. 
  16. Wavenet reserves the right to amend these rules at any time. Wavenet may also create rules, which will apply to a specific competition only. If we do this we will publish the amended competition rules and/or specific competition rules on the relevant competition page. 

[This competition is being run by Wavenet International Pvt Ltd. Of 231 Galle Road, Colombo 4, Sri Lanka.]