Login   Register  
PHP Classes
elePHPant
Icontem

File: libs/Position.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Amin Saeidi  >  Tic-Tac-Toe  >  libs/Position.js  >  Download  
File: libs/Position.js
Role: Auxiliary data
Content type: text/plain
Description: js library
Class: Tic-Tac-Toe
Tic-Tac-Toe game using alpha beta search algorithm
Author: By
Last change:
Date: 2010-11-15 12:22
Size: 478 bytes
 

Contents

Class file image Download
var Position = function()
{
		var board = [0, 0, 0, 0, 0, 0, 0, 0, 0];
		
		return {
			get : function(index){
				if(index == undefined) return board;
				return board[index];
			},
			
			set : function(index, value){
				board[index] = value;
			},
			
			update : function(boardObj){
				for(var i in boardObj){
					this.set(i, boardObj[i]);
				}
			}
		};
}();

var Const = {
		HUMAN : 1,
		BLANK : 0,
		COM : -1,
		
		TURN : this.HUMAN	//indicates who should play now
};