Skip to content

Commit

Permalink
Remove readNode and readState functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreKavalerski committed Jul 7, 2020
1 parent 535758d commit dcd0750
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
14 changes: 1 addition & 13 deletions src/functions/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { State } from '../utils/state';
import { calcHValue } from './heuristic';
import { applyOperation } from './operations';
import HeuristicValue from '../classes/HeuristicValue';
import { readState } from './state';

function generateNodeList(node: NodeInfo, goalState: State): NodeInfo[]{
let childrenNodes: NodeInfo[] = [];
Expand Down Expand Up @@ -49,15 +48,4 @@ function generateNode(state: State, op: operations, goalState: State, gValue: nu
return new NodeInfo(heuristicValue, op, state, previousNode);
}


function readNode(node: NodeInfo): NodeInfo{
readState(node.state);
if(node.previousNode){
return readNode(node.previousNode);
}
else{
return node;
}
}

export { generateNodeList, generateNode, readNode }
export { generateNodeList, generateNode }
10 changes: 1 addition & 9 deletions src/functions/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,4 @@ function convertArrayInState(stateList: StateAsList): State{
return state;
}

function readState(state: State){
console.log('---------');
for(let l of state){
console.log(l);
}
console.log('---------');
}

export { areEqual, includes, readState, isSolvable, convertArrayInState, convertStateInArray }
export { areEqual, includes, isSolvable, convertArrayInState, convertStateInArray }
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { operations } from './utils/operations';
import { State } from "./utils/state";
import { NodeInfo } from "./classes/Node";
import { generateNodeList, generateNode, readNode } from './functions/node';
import { generateNodeList, generateNode } from './functions/node';
import { areEqual, includes, isSolvable } from './functions/state';
import { Frontier } from './utils/frontier';

Expand Down

0 comments on commit dcd0750

Please sign in to comment.