Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.88 KB | None | 0 0
  1. Introduction - The Routers
  2. You want to receive an important message from your colleague's machine that you can only request in bundles.
  3. The request response will include a slice of the message that you will need to put together when all the pieces arrive.
  4. Is your program able to pass your requests in time through the maze and compile a final message with data management and router configuration capabilities?
  5.  
  6. Program logic
  7. The server room consists of 14 routers ([0..13]), each with 20 slots (left [0..9] and right [0..9]). The requests / data can be located in the storage between these slots ([0..9]).
  8. Routers are in ring topology, where the left slots are smaller by one index, the right slots by one index larger by the right and left slots of the router, respectively, and the first to the last (see figure).
  9. During the qualifier, your computer is connected to Router 3, where you start the requests, and your colleague's computer to 10, where you will receive the data.
  10.  
  11. The elements
  12. router
  13.  
  14. Feeders
  15. They have the following characteristics:
  16. Busy, that is, there is a request / data: There can only be one request / data per storage at a time.
  17. Open: Whether to transmit and receive from your slots or from your neighboring storage. These can be set initially or during laps. (character, 0 = closed, 1 = open) Router rules refer to the locking / opening of your containers.
  18. joints
  19. A binding connects the slots of two adjacent routers with the same index.
  20. Binding is permeable to a request / data if the container adjacent to both slots is open and the destination container is not occupied by another.
  21.  
  22. Request / data
  23. It has the following features:
  24.  
  25. the current router and the storage location within it. (non-negative integers)
  26. Unique index (non-negative integer)
  27. Index of the requested piece of the final message (non-negative integer)
  28. Initial router where the message started (non-negative integer)
  29. Destination Router Index (Non-Negative Integer)
  30. Direction (left / right) of which branch of the ring topology goes. (character, l = left, r = right) If the initial router and destination router have the same index, then this is data, otherwise it is a request.
  31. They move automatically depending on:
  32.  
  33. If the request / data of your current location router has one smaller storage open and unoccupied then it moves to that location.
  34. If the binding to the request / data is permeable, you prefer it for the second time
  35. Otherwise, wait for the router rules to change
  36. Requests can only appear on a free storage on a computer-connected router. Each controller can have a maximum of 5 request + data packets on the routers.
  37.  
  38. Modifying router rules
  39. The router has the ability to change the router's rule every turn if there is a packet that it starts on that router. Here's how:
  40.  
  41. The router number and
  42. specifying one direction (positive / negative) (character, '^' negative, 'v' positive): When given a positive direction, all the router storage "takes over" the smaller one. Storage 0 takes over the openness of the largest storage on the router. Negative direction is the opposite.
  43. CAUTION: As rules change, requests / data move in the same direction!
  44.  
  45. If several movement commands are received on a router within a circle, the "result" of these commands will be executed, ie: two positive directions will move the rules by 2, one positive and one negative will have no movement.
  46.  
  47. System protection function: one router rule per turn is automatically changed according to unknown but deterministic rules.
  48.  
  49. Receipt of the request / data
  50. If a request / data reaches any repository on the destination router, it stays in that loop. At the beginning of the next round:
  51.  
  52. If this was a data, it disappears and the sender receives the message.
  53. If this was a request, it changes its direction and destination router back to the sender's router as data in the message.
  54. The process of simulation
  55. The simulation is a turn-by-turn simulation, with the following steps in each turn:
  56.  
  57. Manage your targeted messages
  58. The appearance of new packages
  59. Changes in router rules
  60. Move requests / data one space at a time
  61. If multiple requests / data are moved to a single location, the next priority is to move:
  62. It's the future inside a router.
  63. It comes from a smaller router. The last router with an exception is the exception because it has priority over router 0.
  64. Received requests / data are processed and "frozen" until the next round.
  65. If there is a request / data that can still move, then step 3 continues.
  66. Protocol
  67. The program must communicate through its standard input and standard output according to the following protocol:
  68.  
  69. Initial message
  70. START <team-token: string> <seed: int>
  71.  
  72. The initial message may include the token in the web interface, or optionally the seed of the initial configuration you are considering, which is an integer.
  73.  
  74. Successful connection or at the beginning of each turn
  75. REQUEST <game-id: uint> <tick-id: uint> <start-router-id: uint>
  76. PREVIOUS <message: string>
  77. ROUTER 0 <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0 / 1>
  78. ROUTER 1 <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0 / 1>
  79. ROUTER 2 <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0 / 1>
  80. ROUTER 3 <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0 / 1>
  81. ...
  82. ROUTER 13 <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0/1> <0 / 1>
  83. DATA <current-router-id> <current-store-id> <data-index> <message-id> <from-router-id> <to-router-id> <l / r>
  84. ...
  85. MESSAGE <data-index> <message-piece: string>
  86. ...
  87. .
  88. Where the number after ROUTER is the index of the router, followed by the binary digits listed below, in the order of [0..9] open for the containers (0 = closed, 1 = open)
  89.  
  90. The DATA message has a request / data description
  91.  
  92. The MESSAGE message comes when a data request from you arrives at a router connected to your machine. The message does not contain a whitespace character.
  93.  
  94. The end of the message queue is a. indicates.
  95.  
  96. Reply Options
  97. You can send exactly 1 message to each of the following options. Each command must be preceded by 3 numbers after REQUEST!
  98.  
  99. <game-id> <tick-id> <start-router-id> PASS:
  100.  
  101. The program does nothing.
  102.  
  103. <game-id> <tick-id> <start-router-id> CREATE <store-id> <package-id>:
  104.  
  105. A request is created in the store-id repository specified on your router id. The message will have the package-id index. Its direction will be left first, then alternately right-left ...
  106.  
  107. <game-id> <tick-id> <start-router-id> MOVE <router-id> <dir: ^ / v>:
  108.  
  109. The router will move your router id in the specified direction.
  110.  
  111. <game-id> <tick-id> <start-router-id> SOLUTION <final-message>:
  112.  
  113. Once the final message has been received, the resulting pieces are stitched together (without whitespace characters) and then sent to the simulation. Then, if the solution is right, you are in the next round!
  114.  
  115. The final message
  116. The only thing we know about the final message, that is, the solution, if an empty message part comes in response to a request for one packet, it indicates the end of the message. The first package is the index 0 package, which always contains information.
  117. For each different game-id, this final message (and even its length) will be different!
  118.  
  119. Error, timeout
  120. If there are any incorrect requests to the server (including failed connection), or a timeout occurs (your program thinks for more than 2 seconds within a lap), the server will disconnect after the next message.
  121.  
  122. WRONG <reason: string>
  123. .
  124. There is also a global timeout which is 3 minutes. If the game is not completed during this time, the server will automatically disconnect and the results (and logs) received so far will be lost!
  125.  
  126. Testing
  127. If you manage to solve the problem at least once (with the code in the git, uploaded), you are on your way. After that, you can continue to test your code.
  128.  
  129. You have the following methods:
  130.  
  131. From the surface
  132. It is possible to modify or save the code in the web interface. Each backup will start a new run which will test the current code. The result of this can be viewed on the web interface in the viewer, and any custom logs or communication process written for the standard error can be downloaded. Changes are automatically saved to git.
  133.  
  134. From the git repository
  135. Each team file on the web is stored in its own git version manager, which we also provide direct access to. If someone pushes the master_ [c / cpp / java / python] branch pushed, then a trigger will automatically start the compile and run process from the top of the branch. The result is pushed to the master_log branch. The programming language can only be selected from the interface!
  136.  
  137. network
  138. It is also possible to test remotely on your own machine. To do this, you have to work by downloading the code and redirecting standard input / standard output communication to the TCP address provided in the web interface (eg netcat).
  139. The logs of the games played in this way will not be added to the GIT (they will be lost) or counted for further progress.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement