• API
• FAQ
• Tools
• Archive
daily pastebin goal
64%
SHARE
TWEET

# Untitled

a guest Apr 16th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. When it came to getting two robots to work together, we stuck with our spiral algorithm for cleaning the room as efficiently as possible without retreading the same ground.  Using the same arrangement of sensors as we did with the lone Dennis, we assigned an identity to each robot at runtime. The robot which started in the corner (whom we shall call Kermit) was assigned the identity "1" by detecting an object both on his left (Dennis) and on his right (the wall), while Dennis, having an object detected only to his right is assigned the identity "2".
2.
3. The spiral algorithm works much as before, but the distances travelled are calculated using a new buddy system (see appendix). Kermit will travel the same path as Dennis did alone, but the distance to be travelled is reduced significantly more quickly, as both robots only have to cover half the ground.  As the two robots aim to remain in formation, Dennis will turn when he has travelled far enough but without the wall to hold on to, he will wait for Kermit to navigate the corner and appear next to him before he travels the next side.
4.
5. As our time was limited, we were unable to cure Dennis of his new-found love of tables, and both robots were unable to find their way home, but these would be the first areas of exploration.
6.
7.
8.         if (identity == 2) {
9.             if (turnCount % 4 == 3 || ((turnCount % 4 == 1) && turnCount != 1)){
10.                 sideLength++;
11.             }
12.             if (turnCount >= 1) {
13.                 if (turnCount % 2 == 1) {
14.                   sideLength+=2;
15.                 }
16.             }
17.         } else {
18.             if (turnCount >= 3) {
19.                 if (turnCount % 4 == 3 || ((turnCount % 4 == 1) && turnCount != 1)) {
20.                     sideLength++;
21.                 }
22.                 if (turnCount % 2 == 1) {
23.                   sideLength+=2;
24.                 }
25.             }
26.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top