User Tools

Site Tools


make_a_maze_world

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
make_a_maze_world [2022/09/05 10:13] frchrismake_a_maze_world [2023/09/17 11:21] (current) frchris
Line 1: Line 1:
 ====== Make A Maze World ====== ====== Make A Maze World ======
 +====== Step 1 ======
 1. Make a new Java Project called ''MakeMaze'' and download its two classes: Cell.java an MakeMaze.java <code Java Cell.java>import java.awt.Color; 1. Make a new Java Project called ''MakeMaze'' and download its two classes: Cell.java an MakeMaze.java <code Java Cell.java>import java.awt.Color;
 import java.awt.Graphics; import java.awt.Graphics;
Line 227: Line 228:
  
 }</code> }</code>
 +
 +======Step 2======
 2.  As written it will Make 10 rows and 10 columns, but feel free to change this. 2.  As written it will Make 10 rows and 10 columns, but feel free to change this.
  
 +======Step 3======
 3.  Keep clicking it until you have one you like, and take a screen shot with  3.  Keep clicking it until you have one you like, and take a screen shot with 
 Coomand-Shift-4  Coomand-Shift-4 
Line 234: Line 238:
 {{::bobs.png?400|}} {{::bobs.png?400|}}
  
 +======Step 4======
 4.  Look for it on your Desktop and rename it with your name (For example it might be called ''Screen Shot 2022-08-27 at 8.47.53 AM.png'' and if your name was Bob Smith, you might rename it ''BobS.png'' 4.  Look for it on your Desktop and rename it with your name (For example it might be called ''Screen Shot 2022-08-27 at 8.47.53 AM.png'' and if your name was Bob Smith, you might rename it ''BobS.png''
  
 +======Step 5======
 5.  Next you are to use these commands to make a .kwld text file.  Here is an example That Describes BobS.png: 5.  Next you are to use these commands to make a .kwld text file.  Here is an example That Describes BobS.png:
-<code>+<code text BobS.txt>
 KarelWorld KarelWorld
 streets 7 streets 7
Line 273: Line 279:
     public static void main(String[] args)     public static void main(String[] args)
     {     {
-        World.setDelay(30);       +              
         // change the file name to match the text file          // change the file name to match the text file 
         // you made and put in the project folder:         // you made and put in the project folder:
 +        
         World.readWorld("BobS.txt");          World.readWorld("BobS.txt"); 
-        World.setVisible(); 
         World.setBeeperColor(Color.BLUE);         World.setBeeperColor(Color.BLUE);
-       +        World.setVisible();
     }     }
 } }
 </code> </code>
  
 + Try removing or changing a wall in the BobS.txt file to get a feel of how the code changes the KarelWorld drawn by the ShowWorld main method.
  
-For those who are used to the placeEWWall or placeNSWall methods: +======Step 6 ====== 
-<code World.java>+6. Now it is your turn.  Make a new text file (or rename "BobS.txt" to your first anme and last initial, ending with ".txt").  Start with your first wall.  See the result with ShowWorld.java, and fix it if necessary, Try the next wall.   
 + 
 +When you are done, place 2 beepers in the best locations for the longest run for a MazeRunner robot.   
 + 
 + 
 +=== For those will experience with placeEWWall and placeNEWall === 
 +For those who are used to the [[http://csis.pace.edu/%7Ebergin/KarelJava2ed/KJRdocs/index.html|placeEWWall or placeNSWall]] methods, there is a difference that you may find confusing with the parameters.  For ''eastwestwalls'' the three numbers are (street the wall goes on) (starting on avenue) (ending on ave).  For the ''northsouthwalls'': the three numbers are (Avenue the wal goes on) (Starting street) (Ending Street).  If you already coding it with place walls you can convert it with this
 +<code java World.java>
  
 /** /**
Line 316: Line 330:
 </code>  </code> 
    
 +Alternatively your can use placeWall methods and save the world to file.  
 +====== Links to Karel and KarelWorld Reference ======
 +
 [[http://csis.pace.edu/%7Ebergin/KarelJava2ed/KJRdocs/index.html|Karel API]] [[http://csis.pace.edu/%7Ebergin/KarelJava2ed/KJRdocs/index.html|Karel API]]
 +====== Show and Tell ======
 + Go to [[https:///www.mathorama.com/karel/maze/]] To see other student's work
  
make_a_maze_world.1662387233.txt.gz · Last modified: 2022/09/05 10:13 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki