User Tools

Site Tools


make_a_maze

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
make_a_maze [2019/08/17 11:22] frchrismake_a_maze [2019/08/17 11:35] frchris
Line 33: Line 33:
  }  }
 }</code> }</code>
 +  - You can make a long string and send it all at once to the World.  :<code java>public static void main(String[] args) { 
 + String hurdles = "streets 8\n" +  
 + "avenues 9\n" +  
 + "eastwestwalls 3 1 3\n" +  
 + "northsouthwalls 1 6 5\n" +  
 + "eastwestwalls 6 1 6\n" +  
 + "beepers 1 4 1"; 
 + World.getWorld(hurdles); 
 + World.setVisible(); 
 +        task(); 
 + }</code> 
 +  - You can place a text file with string commands like this: <code> KarelWorld 
 +streets 8 
 +avenues 9 
 +beepers 1 4 1 
 +eastwestwalls 3 1 3 
 +northsouthwalls 1 6 5 
 +eastwestwalls 6 1 6</code>Give the file a name, and add it to your project and use the call <code java> World.readWorld("second.kwld"); </code>
make_a_maze.txt · Last modified: 2021/09/05 13:16 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki