// Generated by CoffeeScript 1.4.0
(function() {
  var SearchProblem, root;

  SearchProblem = (function() {

    function SearchProblem(params) {
      var edge, state, v1, v2, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
      if (params == null) {
        params = {};
      }
      if (params.data == null) {
        this.states = ["S", "A", "B", "C", "D", "G"];
        this.edges = [["S", "A"], ["S", "B"], ["A", "D"], ["D", "B"], ["D", "C"], ["C", "G"], ["B", "C"]];
        this.costs = [1, 1, 1, 1, 1, 1, 5];
        this.heuristic = [4, 3, 6, 1, 2, 0];
      } else {
        this.states = params.data.states;
        this.edgeData = params.data.edgeData;
        this.statePositions = params.data.statePositions;
        this.costs = params.data.costs;
        this.heuristic = params.data.heuristic;
        this.bounds = params.data.bounds;
        this.edges = [];
        _ref = this.edgeData;
        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
          edge = _ref[_i];
          this.edges.push(edge[0]);
        }
        this.graph = {};
        _ref1 = this.states;
        for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
          state = _ref1[_j];
          this.graph[state] = [];
        }
        _ref2 = this.edges;
        for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
          edge = _ref2[_k];
          v1 = edge[0];
          v2 = edge[1];
          this.graph[v1].push(v2);
        }
      }
    }

    SearchProblem.prototype.serialize = function() {
      var data;
      data = {
        states: this.states,
        edges: this.edges,
        edgeData: this.edgeData,
        costs: this.costs,
        heuristic: this.heuristic,
        statePositions: this.statePositions,
        bounds: this.bounds
      };
      return data;
    };

    return SearchProblem;

  })();

  root = typeof exports !== "undefined" && exports !== null ? exports : this;

  root.SearchProblem = SearchProblem;

}).call(this);
