Code coverage report for lib/piece/mobility/rider.js

Statements: 90.91% (60 / 66)      Branches: 96.3% (26 / 27)      Functions: 83.33% (5 / 6)      Lines: 90.91% (60 / 66)      Ignored: none     

All files » lib/piece/mobility/ » rider.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112  1   1       1 1     1 25627   1 1   1449                     1449 84065 418665   1449 1449 1449   1449 1449 1449   3893 3893   2710 2710 2710   2710 2710 2710   12831 12831   10387 10387 10387   10387 10387 10387   46249 46249   35862 35862 35862   41441 41441 41441   41441               41441 41441 41441 41441   41441 41441 41441   41441 41441   41175 41175 41175   41175 41175   1183               1 25627    
"use strict";
Object.defineProperties(exports, {
  Rider: {get: function() {
      return Rider;
    }},
  __esModule: {value: true}
});
var Point = require('../../point').Point;
var $__1 = require('../mobility'),
    Mobility = $__1.Mobility,
    quadrants = $__1.quadrants;
var RiderMobility = function RiderMobility() {
  $traceurRuntime.defaultSuperCall(this, $RiderMobility.prototype, arguments);
};
var $RiderMobility = RiderMobility;
($traceurRuntime.createClass)(RiderMobility, {
  adjacentPoints: $traceurRuntime.initGeneratorFunction(function $__8(position, p0) {
    var $__7,
        m,
        n,
        $__5,
        $__6,
        o,
        $__3,
        $__4,
        p1,
        r,
        pN;
    return $traceurRuntime.createGeneratorInstance(function($ctx) {
      while (true)
        switch ($ctx.state) {
          case 0:
            $__7 = this, m = $__7.m, n = $__7.n;
            $ctx.state = 34;
            break;
          case 34:
            $__5 = [new Point(m, n), new Point(n, m)][$traceurRuntime.toProperty(Symbol.iterator)]();
            $ctx.state = 3;
            break;
          case 3:
            $ctx.state = (!($__6 = $__5.next()).done) ? 29 : -2;
            break;
          case 29:
            o = $__6.value;
            $ctx.state = 30;
            break;
          case 30:
            $__3 = quadrants[$traceurRuntime.toProperty(Symbol.iterator)]();
            $ctx.state = 2;
            break;
          case 2:
            $ctx.state = (!($__4 = $__3.next()).done) ? 25 : 3;
            break;
          case 25:
            p1 = $__4.value;
            $ctx.state = 26;
            break;
          case 26:
            r = 1;
            $ctx.state = 24;
            break;
          case 24:
            $ctx.state = (r < 8) ? 15 : 2;
            break;
          case 20:
            r++;
            $ctx.state = 24;
            break;
          case 15:
            $ctx.pushTry(13, null);
            $ctx.state = 16;
            break;
          case 16:
            throw undefined;
            $ctx.state = 18;
            break;
          case 18:
            $ctx.popTry();
            $ctx.state = 20;
            break;
          case 13:
            $ctx.popTry();
            pN = $ctx.storedException;
            $ctx.state = 11;
            break;
          case 11:
            pN = p0.sum(p1.product(o.product(new Point(r, r))));
            $ctx.state = 12;
            break;
          case 12:
            $ctx.state = 5;
            return pN;
          case 5:
            $ctx.maybeThrow();
            $ctx.state = 7;
            break;
          case 7:
            $ctx.state = (position.pieceByCoords(pN) != null) ? 2 : 20;
            break;
          default:
            return $ctx.end();
        }
    }, $__8, this);
  }),
  toString: function() {
    return ("(" + this.scope + ") rider");
  }
}, {}, Mobility);
function Rider(m, n) {
  this.mobility.push(new RiderMobility(m, n));
}