Guest User

Untitled

a guest
Jan 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. // === robot.js ===
  2. import { BCAbstractRobot } from 'battlecode';
  3. import Test from './test.js';
  4.  
  5. class MyRobot extends BCAbstractRobot {
  6. constructor() {
  7. super();
  8. this.log("asdf"); // the log function does work
  9. // Test.setConsoleLog(this.log); // way 1
  10. // console.log = this.log; // way 2
  11. }
  12. turn() {
  13. Test.testFunction("hello");
  14. return this.move(0, 1);
  15. }
  16. }
  17.  
  18. // === test.js ===
  19. let consoleLog = undefined;
  20.  
  21. function setConsoleLog(c) {
  22. consoleLog = c;
  23. }
  24.  
  25. function testFunction(s) {
  26. // consoleLog(s); // way 1
  27. // console.log(s); // way 2
  28. }
  29.  
  30. export default { testFunction, consoleLog, setConsoleLog };
Add Comment
Please, Sign In to add comment