Programming contests

ECN programozó csapatverseny, 2017. május 13.

May 13, 2017 10:10 AM – May 13, 2017 3:10 PM

A Turing Child Computer

The problem is described in the input.

Input

  1.  
  2.       
  3. A Turing Child Computer 
  4.   
  5. The great-grantchild of the great mathematician and computer scientist Alan Mathison
  6. Turing is a student at the Sapientia University (nicknamed GAMT) and he is studying -- what
  7. else -- Computer Science. He became aware of the fundamental invention of his famous
  8. great-grandfather -- today called Turing machine, -- and he had an idea to further develop this
  9. simple computer.
  10. The main difference of the architecture of his simple computer is a 2D memory cell grid, M --
  11. instead of the linear cell structure of the old Turing machine -- with an address pointer mechanism
  12. which reflects the 2D structure by the possibility of addressing one after another only the neighboring
  13. cells in Left, Right, Up and Down direction. The computer has a single Accumulator
  14. register A, which can hold 0 or positive integer values, just like the memory cells M.
  15. A computer program is a sequence of instruction codes read from a tape one by one
  16. and are immediately executed. The complete instruction set of this computer is listed in the
  17. table below:
  18. -----------------------------------------------------------------------------------------------------------------------
  19. Code Effect/Meaning                                 
  20. -----------------------------------------------------------------------------------------------------------------------
  21. Start/Stop              
  22. 0 start the execution, NOP 
  23. 1 repeat the next instruction 3 times
  24. 2 repeat the next instruction     4 times    
  25. 3 stop the execution
  26. Set memory/pointer/A
  27. 4 clear memory, all memory cells are set to 0, reset memory
  28. 5 set memory pointer to default, reset address pointer 
  29. 6 set Accumulator register A to 0, reset A  
  30. 7 increment A, increase the value of  A by 1
  31. Move memory pointer
  32. 8 step Right, point to the Right neighbour cell    
  33. 9 step  Up, point to the  Up neighbour      cell
  34. 10 step    Left, point to Left  neighbour cell
  35. 11 step  Down, point to  the  Down neighbour     cell 
  36. Read/Write
  37. 12 write A to M, copy the content of A to the currently pointed memory cell   
  38. 13 write A to the standard output, display the character codified by the value of A (see below)   
  39. 14 write (17^A)(mod 37) to the currently pointed memory location, well, thereis an arithmetic coprocessor too:)
  40. 15 read M to A, read the content of the currently pointed memory cell in the Accumulator   
  41. -----------------------------------------------------------------------------------------------------------------------
  42. When the content of A is displayed, each value is the code of a character from the list
  43. below in increasing order, such that the first character has code 1, and the
  44. last character has code 36.
  45. !@_-+.;?/:ABCDEFGHIJKLMNOPQRSTUVWXYZ
  46. GAMT has a message to you, a message displayed by a program which he wrote in the
  47. machine code of his computer. Unfortunately, he hid the code in a tricky way, he said, actually
  48. we are seeing it, without realising we see it.   
  49. Can you discover the program code, and then write an emulator of his computer, run the program,
  50. and send us the message revealed?            
  51.                        
  52. P.S. A last minute hint. We found out that the program code is indeed right here: it
  53. is just hidden in this text file! The two spacing characters of this text has to be converted,
  54. Space and Tab in 1 and 0 respectively, and read as numbers in base two, each group of four is
  55. a machine code.  So all we actually see and read in this text file are just comments for this
  56. hidden code!                                         
  57.    
  58.                   
  59.                     
  60.                   
  61.                 
  62.                     
  63.             
  64.                  
  65.                 
  66.                      
  67.                
  68.                      
  69.                 
  70.              
  71.                       
  72.                
  73.               
  74.                   
  75.            
  76.                  
  77.            
  78.                 
  79.   
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019