@@ -10,6 +10,10 @@ module Mankala {
1010 export var NoScore = 31 ;
1111 export var NoMove = - 1 ;
1212
13+ const bodyId = "body" ;
14+ const humanScoreId = "humscore" ;
15+ const computerScoreId = "compscore"
16+
1317 export interface IPositionList extends Base . IList {
1418 data : Position ;
1519 push ( pos : Position ) ;
@@ -32,7 +36,7 @@ module Mankala {
3236 export function testBrowser ( ) {
3337 var game = new Game ( ) ;
3438 game . interactive ( ) ;
35- var body = < HTMLBodyElement > document . getElementById ( "bod" ) ;
39+ var body = < HTMLBodyElement > document . getElementById ( bodyId ) ;
3640 body . onresize = ( ) => { game . resize ( ) ; } ;
3741 }
3842
@@ -47,12 +51,12 @@ module Mankala {
4751
4852 private features = new Features ( ) ;
4953 private nextSeedCounts : number [ ] = new Array < number > ( 14 ) ;
50- private bod : Element ;
54+ private body : Element ;
5155 private boardElm : Element = null ;
5256
5357 public resize ( ) {
5458 if ( this . boardElm != null ) {
55- this . bod . removeChild ( this . boardElm ) ;
59+ this . body . removeChild ( this . boardElm ) ;
5660 }
5761 this . showMove ( ) ;
5862 }
@@ -77,7 +81,7 @@ module Mankala {
7781 if ( ! this . step ( ) ) {
7882 this . finish ( ) ;
7983 }
80- this . bod . removeChild ( this . boardElm ) ;
84+ this . body . removeChild ( this . boardElm ) ;
8185 this . showMove ( ) ;
8286 } , 1000 ) ;
8387 }
@@ -94,15 +98,15 @@ module Mankala {
9498
9599 private auto ( ) {
96100 // initialize
97- this . bod = document . getElementById ( "bod" ) ;
101+ this . body = document . getElementById ( bodyId ) ;
98102 this . showMove ( ) ;
99103 // run with timeout
100104 this . setStep ( ) ;
101105 }
102106
103107 private showMove ( ) : void {
104- var hsc = document . getElementById ( "humscore" ) ;
105- var csc = document . getElementById ( "compscore" ) ;
108+ var hsc = document . getElementById ( humanScoreId ) ;
109+ var csc = document . getElementById ( computerScoreId ) ;
106110
107111 var g = this ;
108112 if ( ! this . isInteractive ) {
@@ -114,7 +118,7 @@ module Mankala {
114118 ( ( this . position . turn == 0 ) ? " <-Turn" : "" ) ;
115119 csc . innerText = this . position . seedCounts [ storeHouses [ 1 ] ] +
116120 ( ( this . position . turn == 1 ) ? " <-Turn" : "" ) ;
117- this . bod . appendChild ( this . boardElm ) ;
121+ this . body . appendChild ( this . boardElm ) ;
118122 }
119123
120124 public humanMove ( seed : number ) {
@@ -123,7 +127,7 @@ module Mankala {
123127 this . position = new DisplayPosition ( this . nextSeedCounts . slice ( 0 ) , NoMove ,
124128 this . features . turnContinues ? this . position . turn : 1 - this . position . turn ) ;
125129 this . position . config = this . prevConfig ;
126- this . bod . removeChild ( this . boardElm ) ;
130+ this . body . removeChild ( this . boardElm ) ;
127131 this . showMove ( ) ;
128132 if ( this . position . turn == 1 ) {
129133 this . setStep ( ) ;
@@ -133,7 +137,7 @@ module Mankala {
133137
134138 public interactive ( ) {
135139 this . isInteractive = true ;
136- this . bod = document . getElementById ( "bod" ) ;
140+ this . body = document . getElementById ( bodyId ) ;
137141 this . showMove ( ) ;
138142 }
139143
0 commit comments