Skip to content

Instantly share code, notes, and snippets.

@tetsuzuki
Created March 5, 2014 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tetsuzuki/9363861 to your computer and use it in GitHub Desktop.
Save tetsuzuki/9363861 to your computer and use it in GitHub Desktop.
function PiecePos(rank,file,piece){
this.rank = rank;
this.file = file;
this.piece = piece;
}
PiecePos.prototype = {
Add: function(pos1,pos2){
this.rank = pos1.rank + pos2.rank;
this.file = pos1.file + pos2.file;
},
Multiply: function(pos,num){
this.rank = pos.rank * num;
this.file = pos.file * num;
}
}
function Move(from,to,piece,promotion,capture){
this.from = from;
this.to = to;
this.piece = piece;
this.promotion = promotion;
this.capture = capture;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment