1.0.1 • Published 3 years ago

jskarel v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

JsKarel

Code Coverage

Statements Branches Functions Lines

Installation

yarn add jskarel

Usage

import { Karel } from 'jskarel'
const world = {
   width: 5,
   height: 5,
   walls: [
       // wall between 1x1 and 2x1
       { first: {x: 1, y:1}, second: {x: 2, y:1}} 
   ],
   beepers: [{x: 1, y:1}, {x: 2, y: 1}]
}
const karel = new Karel({
    world: world
});
karel.move(); // throws exception because there is a wall
karel.pickBall(); // beeper on 1x1 has been picked up
karel.turnLeft();
karel.move();
expect(karel.position).eql({x: 1, y:2});
expect(karel.world.beepers[0]).eql({x:2, y:1});
1.0.1

3 years ago

1.0.0

3 years ago