text: Dagaz.Controller.persistense = "none";
  
  ZRF = {
      JUMP:          0,
      IF:            1,
      FORK:          2,
      FUNCTION:      3,
      IN_ZONE:       4,
      FLAG:          5,
      SET_FLAG:      6,
      POS_FLAG:      7,
      SET_POS_FLAG:  8,
      ATTR:          9,
      SET_ATTR:      10,
      PROMOTE:       11,
      MODE:          12,
      ON_BOARD_DIR:  13,
      ON_BOARD_POS:  14,
      PARAM:         15,
      LITERAL:       16,
      VERIFY:        20
  };
  
  Dagaz.Model.BuildDesign = function(design) {
      design.checkVersion("z2j", "2");
      design.checkVersion("animate-captures", "false");
      design.checkVersion("smart-moves", "false");
      design.checkVersion("show-hints", "false");
      design.checkVersion("show-blink", "true");
      design.checkVersion("advisor-wait", "5");
  
      design.addDirection("w");
      design.addDirection("e");
      design.addDirection("s");
      design.addDirection("ne");
      design.addDirection("n");
      design.addDirection("se");
      design.addDirection("sw");
      design.addDirection("nw");
  
      design.addPlayer("Black", [1, 0, 4, 6, 2, 7, 3, 5]);
      design.addPlayer("White", [1, 0, 4, 6, 2, 7, 3, 5]);
  
      design.addPosition("a8", [0, 1, 8, 0, 0, 9, 0, 0]);
      design.addPosition("b8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("c8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("d8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("e8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("f8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("g8", [-1, 1, 8, 0, 0, 9, 7, 0]);
      design.addPosition("h8", [-1, 0, 8, 0, 0, 0, 7, 0]);
      design.addPosition("a7", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g7", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h7", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a6", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g6", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h6", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a5", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g5", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h5", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a4", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g4", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h4", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a3", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g3", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h3", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a2", [0, 1, 8, -7, -8, 9, 0, 0]);
      design.addPosition("b2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("c2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("d2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("e2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("f2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("g2", [-1, 1, 8, -7, -8, 9, 7, -9]);
      design.addPosition("h2", [-1, 0, 8, 0, -8, 0, 7, -9]);
      design.addPosition("a1", [0, 1, 0, -7, -8, 0, 0, 0]);
      design.addPosition("b1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("c1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("d1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("e1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("f1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("g1", [-1, 1, 0, -7, -8, 0, 0, -9]);
      design.addPosition("h1", [-1, 0, 0, 0, -8, 0, 0, -9]);
      design.addPosition("X1", [0, 0, 0, 0, 0, 0, 0, 0]);
      design.addPosition("X2", [0, 0, 0, 0, 0, 0, 0, 0]);
      design.addPosition("X3", [0, 0, 0, 0, 0, 0, 0, 0]);
  
      design.addZone("promotion", 2, [56, 58, 60, 62]);
      design.addZone("promotion", 1, [1, 3, 5, 7]);
  
      design.addCommand(0, ZRF.FUNCTION,	24);	// from
      design.addCommand(0, ZRF.PARAM,	0);	// $1
      design.addCommand(0, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(0, ZRF.FUNCTION,	2);	// enemy?
      design.addCommand(0, ZRF.FUNCTION,	20);	// verify
      design.addCommand(0, ZRF.FUNCTION,	26);	// capture
      design.addCommand(0, ZRF.PARAM,	1);	// $2
      design.addCommand(0, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(0, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(0, ZRF.FUNCTION,	20);	// verify
      design.addCommand(0, ZRF.IN_ZONE,	0);	// promotion
      design.addCommand(0, ZRF.FUNCTION,	0);	// not
      design.addCommand(0, ZRF.IF,	4);
      design.addCommand(0, ZRF.PROMOTE,	1);	// King
      design.addCommand(0, ZRF.FUNCTION,	25);	// to
      design.addCommand(0, ZRF.JUMP,	3);
      design.addCommand(0, ZRF.MODE,	0);	// jump-type
      design.addCommand(0, ZRF.FUNCTION,	25);	// to
      design.addCommand(0, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(1, ZRF.FUNCTION,	24);	// from
      design.addCommand(1, ZRF.PARAM,	0);	// $1
      design.addCommand(1, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(1, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(1, ZRF.FUNCTION,	20);	// verify
      design.addCommand(1, ZRF.IN_ZONE,	0);	// promotion
      design.addCommand(1, ZRF.FUNCTION,	0);	// not
      design.addCommand(1, ZRF.IF,	4);
      design.addCommand(1, ZRF.PROMOTE,	1);	// King
      design.addCommand(1, ZRF.FUNCTION,	25);	// to
      design.addCommand(1, ZRF.JUMP,	2);
      design.addCommand(1, ZRF.FUNCTION,	25);	// to
      design.addCommand(1, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(2, ZRF.FUNCTION,	24);	// from
      design.addCommand(2, ZRF.PARAM,	0);	// $1
      design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(2, ZRF.FUNCTION,	2);	// enemy?
      design.addCommand(2, ZRF.FUNCTION,	20);	// verify
      design.addCommand(2, ZRF.FUNCTION,	26);	// capture
      design.addCommand(2, ZRF.PARAM,	1);	// $2
      design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(2, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(2, ZRF.FUNCTION,	20);	// verify
      design.addCommand(2, ZRF.MODE,	0);	// jump-type
      design.addCommand(2, ZRF.FUNCTION,	25);	// to
      design.addCommand(2, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(3, ZRF.FUNCTION,	24);	// from
      design.addCommand(3, ZRF.PARAM,	0);	// $1
      design.addCommand(3, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(3, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(3, ZRF.FUNCTION,	20);	// verify
      design.addCommand(3, ZRF.FUNCTION,	25);	// to
      design.addCommand(3, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(4, ZRF.FUNCTION,	24);	// from
      design.addCommand(4, ZRF.PARAM,	0);	// $1
      design.addCommand(4, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(4, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(4, ZRF.FUNCTION,	0);	// not
      design.addCommand(4, ZRF.IF,	4);
      design.addCommand(4, ZRF.PARAM,	1);	// $2
      design.addCommand(4, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(4, ZRF.JUMP,	-5);
      design.addCommand(4, ZRF.FUNCTION,	2);	// enemy?
      design.addCommand(4, ZRF.FUNCTION,	20);	// verify
      design.addCommand(4, ZRF.FUNCTION,	25);	// to
      design.addCommand(4, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(5, ZRF.FUNCTION,	24);	// from
      design.addCommand(5, ZRF.PARAM,	0);	// $1
      design.addCommand(5, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(5, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(5, ZRF.FUNCTION,	0);	// not
      design.addCommand(5, ZRF.IF,	7);
      design.addCommand(5, ZRF.FORK,	3);
      design.addCommand(5, ZRF.FUNCTION,	25);	// to
      design.addCommand(5, ZRF.FUNCTION,	28);	// end
      design.addCommand(5, ZRF.PARAM,	1);	// $2
      design.addCommand(5, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(5, ZRF.JUMP,	-8);
      design.addCommand(5, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(6, ZRF.FUNCTION,	24);	// from
      design.addCommand(6, ZRF.PARAM,	0);	// $1
      design.addCommand(6, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(6, ZRF.PARAM,	1);	// $2
      design.addCommand(6, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(6, ZRF.PARAM,	2);	// $3
      design.addCommand(6, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(6, ZRF.FUNCTION,	2);	// enemy?
      design.addCommand(6, ZRF.FUNCTION,	20);	// verify
      design.addCommand(6, ZRF.FUNCTION,	25);	// to
      design.addCommand(6, ZRF.FUNCTION,	28);	// end
  
      design.addCommand(7, ZRF.FUNCTION,	24);	// from
      design.addCommand(7, ZRF.PARAM,	0);	// $1
      design.addCommand(7, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(7, ZRF.PARAM,	1);	// $2
      design.addCommand(7, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(7, ZRF.PARAM,	2);	// $3
      design.addCommand(7, ZRF.FUNCTION,	22);	// navigate
      design.addCommand(7, ZRF.FUNCTION,	1);	// empty?
      design.addCommand(7, ZRF.FUNCTION,	20);	// verify
      design.addCommand(7, ZRF.FUNCTION,	25);	// to
      design.addCommand(7, ZRF.FUNCTION,	28);	// end
  
  //  design.addPriority(0);			// jump-type
  //  design.addPriority(1);			// normal-type
  
      design.addPiece("Man", 0, 1);
      design.addMove(0, 0, [7, 7], 0);
      design.addMove(0, 0, [3, 3], 0);
      design.addMove(0, 1, [7], 1);
      design.addMove(0, 1, [3], 1);
  
      design.addPiece("King", 1, 100);
      design.addMove(1, 2, [7, 7], 0);
      design.addMove(1, 2, [3, 3], 0);
      design.addMove(1, 2, [6, 6], 0);
      design.addMove(1, 2, [5, 5], 0);
      design.addMove(1, 3, [7], 1);
      design.addMove(1, 3, [3], 1);
      design.addMove(1, 3, [6], 1);
      design.addMove(1, 3, [5], 1);
  
      design.addPiece("Bishop", 2, 15);
      design.addMove(2, 4, [7, 7], 0);
      design.addMove(2, 4, [3, 3], 0);
      design.addMove(2, 4, [6, 6], 0);
      design.addMove(2, 4, [5, 5], 0);
      design.addMove(2, 5, [7, 7], 1);
      design.addMove(2, 5, [3, 3], 1);
      design.addMove(2, 5, [6, 6], 1);
      design.addMove(2, 5, [5, 5], 1);
  
      design.addPiece("Camel", 3, 20);
      design.addMove(3, 6, [4, 4, 7], 0);
      design.addMove(3, 6, [4, 4, 3], 0);
      design.addMove(3, 6, [2, 2, 6], 0);
      design.addMove(3, 6, [2, 2, 5], 0);
      design.addMove(3, 6, [0, 0, 6], 0);
      design.addMove(3, 6, [0, 0, 7], 0);
      design.addMove(3, 6, [1, 1, 5], 0);
      design.addMove(3, 6, [1, 1, 3], 0);
      design.addMove(3, 7, [4, 4, 7], 1);
      design.addMove(3, 7, [4, 4, 3], 1);
      design.addMove(3, 7, [2, 2, 6], 1);
      design.addMove(3, 7, [2, 2, 5], 1);
      design.addMove(3, 7, [0, 0, 6], 1);
      design.addMove(3, 7, [0, 0, 7], 1);
      design.addMove(3, 7, [1, 1, 5], 1);
      design.addMove(3, 7, [1, 1, 3], 1);
  
      design.setup("Black", "Man", 40);
      design.setup("Black", "Man", 49);
      design.setup("Black", "Man", 42);
      design.setup("Black", "Man", 51);
      design.setup("Black", "Man", 44);
      design.setup("Black", "Man", 53);
      design.setup("Black", "Man", 46);
      design.setup("Black", "Man", 55);
      design.setup("Black", "Bishop", 56);
      design.setup("Black", "King", 58);
      design.setup("Black", "King", 60);
      design.setup("Black", "Camel", 62);
      design.setup("White", "Man", 8);
      design.setup("White", "Man", 17);
      design.setup("White", "Man", 10);
      design.setup("White", "Man", 19);
      design.setup("White", "Man", 12);
      design.setup("White", "Man", 21);
      design.setup("White", "Man", 14);
      design.setup("White", "Man", 23);
      design.setup("White", "Bishop", 7);
      design.setup("White", "King", 3);
      design.setup("White", "King", 5);
      design.setup("White", "Camel", 1);
  }
  
  Dagaz.View.configure = function(view) {
      view.defBoard("Board");
      view.defPiece("WhiteMan", "White Man");
      view.defPiece("BlackMan", "Black Man");
      view.defPiece("WhiteKing", "White King");
      view.defPiece("BlackKing", "Black King");
      view.defPiece("WhiteBishop", "White Bishop");
      view.defPiece("BlackBishop", "Black Bishop");
      view.defPiece("WhiteCamel", "White Camel");
      view.defPiece("BlackCamel", "Black Camel");
   
      view.defPosition("a8", 352, 352, 50, 50);
      view.defPosition("b8", 302, 352, 50, 50);
      view.defPosition("c8", 252, 352, 50, 50);
      view.defPosition("d8", 202, 352, 50, 50);
      view.defPosition("e8", 152, 352, 50, 50);
      view.defPosition("f8", 102, 352, 50, 50);
      view.defPosition("g8", 52, 352, 50, 50);
      view.defPosition("h8", 2, 352, 50, 50);
      view.defPosition("a7", 352, 302, 50, 50);
      view.defPosition("b7", 302, 302, 50, 50);
      view.defPosition("c7", 252, 302, 50, 50);
      view.defPosition("d7", 202, 302, 50, 50);
      view.defPosition("e7", 152, 302, 50, 50);
      view.defPosition("f7", 102, 302, 50, 50);
      view.defPosition("g7", 52, 302, 50, 50);
      view.defPosition("h7", 2, 302, 50, 50);
      view.defPosition("a6", 352, 252, 50, 50);
      view.defPosition("b6", 302, 252, 50, 50);
      view.defPosition("c6", 252, 252, 50, 50);
      view.defPosition("d6", 202, 252, 50, 50);
      view.defPosition("e6", 152, 252, 50, 50);
      view.defPosition("f6", 102, 252, 50, 50);
      view.defPosition("g6", 52, 252, 50, 50);
      view.defPosition("h6", 2, 252, 50, 50);
      view.defPosition("a5", 352, 202, 50, 50);
      view.defPosition("b5", 302, 202, 50, 50);
      view.defPosition("c5", 252, 202, 50, 50);
      view.defPosition("d5", 202, 202, 50, 50);
      view.defPosition("e5", 152, 202, 50, 50);
      view.defPosition("f5", 102, 202, 50, 50);
      view.defPosition("g5", 52, 202, 50, 50);
      view.defPosition("h5", 2, 202, 50, 50);
      view.defPosition("a4", 352, 152, 50, 50);
      view.defPosition("b4", 302, 152, 50, 50);
      view.defPosition("c4", 252, 152, 50, 50);
      view.defPosition("d4", 202, 152, 50, 50);
      view.defPosition("e4", 152, 152, 50, 50);
      view.defPosition("f4", 102, 152, 50, 50);
      view.defPosition("g4", 52, 152, 50, 50);
      view.defPosition("h4", 2, 152, 50, 50);
      view.defPosition("a3", 352, 102, 50, 50);
      view.defPosition("b3", 302, 102, 50, 50);
      view.defPosition("c3", 252, 102, 50, 50);
      view.defPosition("d3", 202, 102, 50, 50);
      view.defPosition("e3", 152, 102, 50, 50);
      view.defPosition("f3", 102, 102, 50, 50);
      view.defPosition("g3", 52, 102, 50, 50);
      view.defPosition("h3", 2, 102, 50, 50);
      view.defPosition("a2", 352, 52, 50, 50);
      view.defPosition("b2", 302, 52, 50, 50);
      view.defPosition("c2", 252, 52, 50, 50);
      view.defPosition("d2", 202, 52, 50, 50);
      view.defPosition("e2", 152, 52, 50, 50);
      view.defPosition("f2", 102, 52, 50, 50);
      view.defPosition("g2", 52, 52, 50, 50);
      view.defPosition("h2", 2, 52, 50, 50);
      view.defPosition("a1", 352, 2, 50, 50);
      view.defPosition("b1", 302, 2, 50, 50);
      view.defPosition("c1", 252, 2, 50, 50);
      view.defPosition("d1", 202, 2, 50, 50);
      view.defPosition("e1", 152, 2, 50, 50);
      view.defPosition("f1", 102, 2, 50, 50);
      view.defPosition("g1", 52, 2, 50, 50);
      view.defPosition("h1", 2, 2, 50, 50);
  
      view.defPopup("Promote", 114, 70);
      view.defPopupPosition("X1", 10, 7, 50, 50);
      view.defPopupPosition("X2", 62, 7, 50, 50);
      view.defPopupPosition("X3", 115, 7, 50, 50);
  }
  