4 ms·
Thank you, great solution. It matches the spirit of the contest as well. If you want another challenge, you could try to get to that result by doing the equiva
by logicallee 2y ago
Thank you, great solution. It matches the spirit of the contest as well. If you want another challenge, you could try to get to that result by doing the equivalent of sending keypresses, further mimicking how a robot works. (You can just copy and paste the keys the keyPressed function calls and check the distances yourself).
const angleIncrement = PI / 36;
if (key === 'q') { upperArmAngle -= angleIncrement; moves++; }
if (key === 'w') { upperArmAngle += angleIncrement; moves++; }
if (key === 'a') { lowerArmAngle -= angleIncrement; moves++; }
if (key === 's') { lowerArmAngle += angleIncrement; moves++; }
if (key === 'g') grab(); // Grab the fruit
if (key === 'r') release(); // Release the fruit
What order of these statements would you send to get to the fruit, grab it, and then get to the result you show?
Good job on completing the contest.
- logicallee 2y agoHere's the code with keypresses being sent: https://editor.p5js.org/robss2020/sketches/46cRgGQtX https://editor.p5js.org/robss2020/sketches/46cRgGQtX