Karel -the Robot learns Java using Eclipse Tutorial


 Karel The Robot is a robot simulator that affords a gentle introduction to computer programming. Users write Karel programs and feed them to the simulator to watch them execute.

By solving karel problems you will build your logic and enjoy programming.


<-Karel 


Karel- its a robot.. its has its own world that is known as the grid. The grid has avenues (column) and streets(rows). Karel is placed at the 1st street and 1st avenues ie 1,1 if denotes in Cartesian co-ordinates.  

 This is Karels World.







Karel has only four Main functions :
1. move()- that makes karel move one step ahead.
2. putBeeper()- It puts a beeper.
3.pickBeeper()- it picks a beeper.
4. turnLeft()-makes karel turn left at that place itself.

It is simialr to JAVA so it is helpful for those who are  learning JAVA. It also supports object oriented programming ie u don’t need to define a function every time if u want to use instead in OOP u can write function once inside a class then u can call the function by creating an object of that class and then calling it..

to download karel, click
to install: Download an assignment from clicck(in this assiggnments)
   
Import button
After downloading both the assignment and eclipse IDE, unrar it and open Eclipse.exe, then click on the import button ----------------------------------------------------------------->


Then use the browser to find Assignment-1 folder.When you do so, Eclipse will load the starter project and display its name in the Package Explorer window like this:


Then click on the small triangle and start doing solving the problem.


Now lets do a simple Karel program : 

Q.we will solve a problem from assignment-1 ie CollectNewspaper(the documentation for the problem is available in, handouts-assignment 1)


clip of problem (we have to get the beeper):   
 Code is:
 
import stanford.karel.*;

public class CollectNewspaperKarel extends Karel{

    public void run(){
          move();
          turnRight();
          move();
          turnLeft();
          move();
          pickBeeper();
    }

    public void turnRight(){
          turnLeft();
          turnLeft();
          turnLeft();
    }


Karels running interface is :








To learn Karel download the book : www.stanford.edu/class/cs106a/book/karel-the-robot-learns-java.pdf

Comments