Chapter 8 Example 8

by actionscriptbible
♥0 | Line 28 | Modified 2009-06-12 06:43:51 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/5OO2
 */

package {
  import com.actionscriptbible.Example;
  
  public class ch8ex8 extends Example {
    private const k:String = "King";
    private const q:String = "Queen";
    private const b:String = "Bishop";
    private const n:String = "Knight";
    private const r:String = "Rook";
    private const p:String = "Pawn";
    private const _:String = "empty";
    
    public function ch8ex8() {
      
      var chessBoard:Array = [
        [r,n,b,q,k,b,n,r],
        [p,p,p,p,p,p,p,p],
        [_,_,_,_,_,_,_,_],
        [_,_,_,_,_,_,_,_],
        [_,_,_,_,_,_,_,_],
        [_,_,_,_,_,_,_,_],
        [p,p,p,p,p,p,p,p],
        [r,n,b,q,k,b,n,r]
      ];
      
      trace("Piece at (0,2) :", chessBoard[0][2]);
      trace("Piece at (7,4) :", chessBoard[7][4]);
      trace("Piece at (4,3) :", chessBoard[4][3]);
      trace("Piece at (7,7) :", chessBoard[7][7]);
    }
  }
}