Note that since the program accepts no input from the user, there is no user interface to test. Instead, concentrate upon analysing the results to show how the algorithm has been correctly implemented. Output Explanation: 1. For each phase of the game, lists the status of each player as either active or blocked (e.g. [A, B, B, B, B] would mean that player 0 is active but all others are blocked). The message that follows is the message that the player receives to pass on after modifying. 2. The program is run twice to demonstrate the true randomness of the modifications. -------+---------+----------------------------------------------+------------------------------------------------------ Test # | Line #s | Key Point of Test | Analysis of Test -------+---------+----------------------------------------------+------------------------------------------------------ 1 | 1-11 | Only one user is active at a time | Out of the 5 players, 4 are marked as 'B'locked, and | | | only one is marked as 'A'ctive. Note that the correct | | | number of players are created. -------+---------+----------------------------------------------+------------------------------------------------------ 2 | 1-11 | Control cycles through the users | As can be seen by the succession of activity tables, | | | control passes from player i to player i+1. Upon | | | reaching NUMPLAYER-1, control passes back to player 0 | | | ( 0 <= i <= NUMPLAYER-1). -------+---------+----------------------------------------------+------------------------------------------------------ 3 | 1,8,13 | Play stops upon reaching the second cycle | Upon having the message traverse the ring twice, | 14-20 | | the game is halted. This is confirmed by the number | | | of passes (11, terminates on the 12th). -------+---------+----------------------------------------------+------------------------------------------------------ 4 | 14-20 | All players terminate | All players print a termination message in their | | | destructor, and the message appears once for each. | | | Each termination message confirms that the players | | | were initialized with the correct ids. -------+---------+----------------------------------------------+------------------------------------------------------ 5 | 3-13,19 | For each message pass, the message is changed| As can be seen by carefully comparing the initial | 22-32, | randomly in one position's character value | message to each subsequent message printed, only one | 38 | | character's value is changed each time. It is changed | | | randomly, varying from index 0 to 14 (last position) | | | and the value to which the character is changed is | | | also random. The final messages are different between | | | each game. -------+---------+----------------------------------------------+------------------------------------------------------ 1 Script started on Thu May 14 22:11:49 1998 2 [31]% ./telephone 3 1 [A, B, B, B, B] 'abcdefghijkl' 4 2 [B, A, B, B, B] 'abcdeighijkl' 5 3 [B, B, A, B, B] 'abcdeighijkO' 6 4 [B, B, B, A, B] 'abcdeighijk\' 7 5 [B, B, B, B, A] 'abcdeighij^\' 8 6 [A, B, B, B, B] 'abcdeigyij^\' 9 7 [B, A, B, B, B] 'abcdeigyij^f' 10 8 [B, B, A, B, B] 'abcdeigyi3^f' 11 9 [B, B, B, A, B] 'abcdeigyi3^J' 12 10 [B, B, B, B, A] 'abcgeigyi3^J' 13 11 [A, B, B, B, B] 'abcgeigyu3^J' 14 Player 0 terminating 15 Player 1 terminating 16 Player 2 terminating 17 Player 3 terminating 18 Player 4 terminating 19 Final message was: 'abcgeigyj3^J' 20 (UNIX pid:15444) (uHeap *)0xb8420.uDoFree(): program terminating with 288(0x120) bytes of storage allocated but not freed. 21 [32]% ./telephone 22 1 [A, B, B, B, B] 'abcdefghijkl' 23 2 [B, A, B, B, B] 'abcdefghijal' 24 3 [B, B, A, B, B] 'abUdefghijal' 25 4 [B, B, B, A, B] 'abUde]ghijal' 26 5 [B, B, B, B, A] '.bUde]ghijal' 27 6 [A, B, B, B, B] '.b6de]ghijal' 28 7 [B, A, B, B, B] '.b6de]ghijal' 29 8 [B, B, A, B, B] '.b6dw]ghijal' 30 9 [B, B, B, A, B] '.b6dw]ghijnl' 31 10 [B, B, B, B, A] '.b6dw]ghZjnl' 32 11 [A, B, B, B, B] '.b6dw]ghZjn`' 33 Player 0 terminating 34 Player 1 terminating 35 Player 2 terminating 36 Player 3 terminating 37 Player 4 terminating 38 Final message was: '.b6dw