-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from orionsbelt-battlegrounds/Convert-To-Players
Convert to players
- Loading branch information
Showing
7 changed files
with
728 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var basePositionConverter = require("./basePositionConverter.js"); | ||
|
||
function convertToPlayer1(players) { | ||
this.base = new basePositionConverter(players); | ||
} | ||
|
||
convertToPlayer1.prototype.resolveUltimateCoordinate = function(coord){ | ||
return this.base.resolveUltimateCoordinate(coord); | ||
}; | ||
|
||
convertToPlayer1.prototype.convertPositionToSpecific = function(position){ | ||
return this.base.convertPositionToSpecific(position); | ||
}; | ||
|
||
convertToPlayer1.prototype.convertPositionToBase = function(position){ | ||
return this.base.convertPositionToBase(position); | ||
}; | ||
|
||
convertToPlayer1.prototype.maxCoordinateValue = function(){ | ||
return this.base.maxCoordinateValue(); | ||
}; | ||
|
||
convertToPlayer1.prototype.convertCoordinateToBase = function (coord){ | ||
return this.base.convertCoordinateToBase(coord); | ||
}; | ||
|
||
convertToPlayer1.prototype.convertCoordinateToSpecific = function (coord){ | ||
return this.base.convertCoordinateToSpecific(coord); | ||
}; | ||
|
||
module.exports = convertToPlayer1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var basePositionConverter = require("./basePositionConverter.js"); | ||
var positionType = require("./positionType.js"); | ||
var coordinate = require("./../coordinate.js"); | ||
|
||
new positionType(); | ||
var positionConversion = []; | ||
positionConversion[positionType.position["N"]] = positionType.position["S"]; | ||
positionConversion[positionType.position["S"]] = positionType.position["N"]; | ||
positionConversion[positionType.position["W"]] = positionType.position["E"]; | ||
positionConversion[positionType.position["E"]] = positionType.position["W"]; | ||
|
||
function convertToPlayer2(players) { | ||
this.base = new basePositionConverter(players); | ||
} | ||
|
||
|
||
convertToPlayer2.prototype.convertPositionToBase = function(position){ | ||
return GetPostion(position); | ||
}; | ||
|
||
|
||
convertToPlayer2.prototype.convertPositionToSpecific = function(position){ | ||
return GetPostion(position); | ||
}; | ||
|
||
convertToPlayer2.prototype.convertCoordinateToBase = function (coord){ | ||
var ultimate = this.resolveUltimateCoordinate(coord); | ||
if( ultimate != null ) { | ||
return ultimate; | ||
} | ||
var x = this.maxCoordinateValue() - coord.x; | ||
var y = this.maxCoordinateValue() - coord.y; | ||
|
||
return new coordinate(x,y); | ||
}; | ||
|
||
convertToPlayer2.prototype.convertCoordinateToSpecific = function (coord){ | ||
return this.convertCoordinateToBase(coord); | ||
}; | ||
|
||
|
||
convertToPlayer2.prototype.resolveUltimateCoordinate = function(coord){ | ||
return this.base.resolveUltimateCoordinate(coord); | ||
}; | ||
|
||
convertToPlayer2.prototype.maxCoordinateValue = function(){ | ||
return this.base.maxCoordinateValue(); | ||
}; | ||
|
||
function GetPostion(position){ | ||
if(positionConversion[position] === undefined){ | ||
return null; | ||
} | ||
return positionConversion[position]; | ||
} | ||
|
||
module.exports = convertToPlayer2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
var basePositionConverter = require("./basePositionConverter.js"); | ||
var positionType = require("./positionType.js"); | ||
var coordinate = require("./../coordinate.js"); | ||
|
||
new positionType(); | ||
var positionConversion = []; | ||
positionConversion[positionType.position["N"]] = positionType.position["E"]; | ||
positionConversion[positionType.position["S"]] = positionType.position["W"]; | ||
positionConversion[positionType.position["W"]] = positionType.position["N"]; | ||
positionConversion[positionType.position["E"]] = positionType.position["S"]; | ||
|
||
var positionConversionToSpecific = []; | ||
positionConversionToSpecific[positionType.position["N"]] = positionType.position["W"]; | ||
positionConversionToSpecific[positionType.position["S"]] = positionType.position["E"]; | ||
positionConversionToSpecific[positionType.position["W"]] = positionType.position["S"]; | ||
positionConversionToSpecific[positionType.position["E"]] = positionType.position["N"]; | ||
|
||
function convertToPlayer3(players) { | ||
this.base = new basePositionConverter(players); | ||
} | ||
|
||
|
||
convertToPlayer3.prototype.convertPositionToBase = function(position){ | ||
if(positionConversion[position] === undefined){ | ||
return null; | ||
} | ||
return positionConversion[position]; | ||
}; | ||
|
||
|
||
convertToPlayer3.prototype.convertPositionToSpecific = function(position){ | ||
if(positionConversionToSpecific[position] === undefined){ | ||
return null; | ||
} | ||
return positionConversionToSpecific[position]; | ||
|
||
}; | ||
|
||
convertToPlayer3.prototype.convertCoordinateToBase = function (coord){ | ||
//var x = coord.y; | ||
//var y = this.maxCoordinateValue() - coord.x; | ||
|
||
var y = coord.x; | ||
var x = this.maxCoordinateValue() - coord.y; | ||
|
||
return new coordinate(x,y); | ||
}; | ||
|
||
convertToPlayer3.prototype.convertCoordinateToSpecific = function (coord){ | ||
//var x = this.maxCoordinateValue() - coord.y; | ||
//var y = coord.x; | ||
|
||
var y = this.maxCoordinateValue() - coord.x; | ||
var x = coord.y; | ||
|
||
return new coordinate(x,y); | ||
}; | ||
|
||
|
||
convertToPlayer3.prototype.resolveUltimateCoordinate = function(coord){ | ||
return this.base.resolveUltimateCoordinate(coord); | ||
}; | ||
|
||
convertToPlayer3.prototype.maxCoordinateValue = function(){ | ||
return this.base.maxCoordinateValue(); | ||
}; | ||
|
||
module.exports = convertToPlayer3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
var basePositionConverter = require("./basePositionConverter.js"); | ||
var positionType = require("./positionType.js"); | ||
var coordinate = require("./../coordinate.js"); | ||
|
||
new positionType(); | ||
var positionConversion = []; | ||
positionConversion[positionType.position["N"]] = positionType.position["W"]; | ||
positionConversion[positionType.position["S"]] = positionType.position["E"]; | ||
positionConversion[positionType.position["W"]] = positionType.position["S"]; | ||
positionConversion[positionType.position["E"]] = positionType.position["N"]; | ||
|
||
var positionConversionToSpecific = []; | ||
positionConversionToSpecific[positionType.position["N"]] = positionType.position["E"]; | ||
positionConversionToSpecific[positionType.position["S"]] = positionType.position["W"]; | ||
positionConversionToSpecific[positionType.position["W"]] = positionType.position["N"]; | ||
positionConversionToSpecific[positionType.position["E"]] = positionType.position["S"]; | ||
|
||
function convertToPlayer4(players) { | ||
this.base = new basePositionConverter(players); | ||
} | ||
|
||
|
||
convertToPlayer4.prototype.convertPositionToBase = function(position){ | ||
if(positionConversion[position] === undefined){ | ||
return null; | ||
} | ||
return positionConversion[position]; | ||
}; | ||
|
||
|
||
convertToPlayer4.prototype.convertPositionToSpecific = function(position){ | ||
if(positionConversionToSpecific[position] === undefined){ | ||
return null; | ||
} | ||
return positionConversionToSpecific[position]; | ||
|
||
}; | ||
|
||
convertToPlayer4.prototype.convertCoordinateToBase = function (coord){ | ||
//var y = coord.x; | ||
//var x = this.maxCoordinateValue() - coord.y; | ||
|
||
var x = coord.y; | ||
var y = this.maxCoordinateValue() - coord.x; | ||
|
||
return new coordinate(x,y); | ||
}; | ||
|
||
convertToPlayer4.prototype.convertCoordinateToSpecific = function (coord){ | ||
//var y = this.maxCoordinateValue() - coord.x; | ||
//var x = coord.y; | ||
|
||
var x = this.maxCoordinateValue() - coord.y; | ||
var y = coord.x; | ||
|
||
return new coordinate(x,y); | ||
}; | ||
|
||
|
||
convertToPlayer4.prototype.resolveUltimateCoordinate = function(coord){ | ||
return this.base.resolveUltimateCoordinate(coord); | ||
}; | ||
|
||
convertToPlayer4.prototype.maxCoordinateValue = function(){ | ||
return this.base.maxCoordinateValue(); | ||
}; | ||
|
||
module.exports = convertToPlayer4; |
Oops, something went wrong.