Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Merge pull request #87 from HC-Interns/remove-validation
Browse files Browse the repository at this point in the history
Remove validation
  • Loading branch information
willemolding authored Aug 9, 2018
2 parents 3d38062 + bd49376 commit 5327540
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 186 deletions.
23 changes: 12 additions & 11 deletions dna-src/minersweeper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,18 @@ function isDead(gameBoard: GameBoard, actions: Action[]): boolean {
// the main validation function of the game. All game rules are enforced here
// only allow actions to be taken on locations that have not aready been acted on
function validateAddAction(gameHash, actionHash, agentHash) {
let action: Action = get(actionHash);
if(action.actionType === "chat") return true;

let gameBoard: GameBoard = get(gameHash);
let actions = getLinks(gameHash, "", {Load: true}).map(function(elem) {
return elem.Entry;
});
return !actions.some((existingAction: Action) => {
if(existingAction.actionType === "chat" || action.actionType === "chat") return false;
return action.position.x === existingAction.position.x && action.position.y === existingAction.position.y;
});
return true;
// let action: Action = get(actionHash);
// if(action.actionType === "chat") return true;

// let gameBoard: GameBoard = get(gameHash);
// let actions = getLinks(gameHash, "", {Load: true}).map(function(elem) {
// return elem.Entry;
// });
// return !actions.some((existingAction: Action) => {
// if(existingAction.actionType === "chat" || action.actionType === "chat") return false;
// return action.position.x === existingAction.position.x && action.position.y === existingAction.position.y;
// });
}

// ensures a game board is valid before it can be added
Expand Down
Loading

0 comments on commit 5327540

Please sign in to comment.