Board Game Advice?

Hey guys,

If you’ve read some of most posts you’ll know that I’ve not being actionscripting for long but have (what I believe to be) a fairly good understanding of how things work. I was thinking about making a khet/chess style strategic board game to further my understanding of as3 and start working on AI. And was wondering if anyone could lend some insight on perhaps where I should start?

Any advice ould be greatly appreciated :slight_smile:

I’ve started just a little test app before going on to make the game, so as i previously stated, any advice on where to start/what to know/etc… would be greatly appreciated.

Though I’ve just started to do a simple board creation function, but there’s a strange issue:

 
private var boardSet:Boolean = false;
private var seg1:BoardSeg;
private var seg2:BorderSeg;
private var colNum:int = 11;
private var rowNum:int = 8;
private var tmpCol:int = 0;
private var tmpRow:int = 0;
private var startX:int = 120;
private var startY:int = 80;
private var segX:int;
private var segY:int;

private function setBoard ():void {
         
   segX = startX;
   segY = startY;
         
   for (var i:int = 0; i < (colNum * rowNum); i++) {
      if (tmpCol < colNum - 1) {
         if (tmpCol == 0 || (tmpCol == colNum - 3 && (tmpRow == 0 || tmpRow == rowNum - 1))) {
            seg1 = new BoardSeg(0xFF0000);
         } else if (tmpCol == colNum - 2 || (tmpCol == 1 && (tmpRow == 0 || tmpRow == rowNum - 1))) {
            seg1 = new BoardSeg(0x0000FF);
         } else {
            seg1 = new BoardSeg(0xFFFFFF);
         }
         addChild(seg1);
         seg1.x = segX;
         seg1.y = segY;
         segX = seg1.x + seg1.width + 1;
         tmpCol++
      } else if (tmpCol == colNum - 1) {
         segX = startX;
         segY = seg1.y + seg1.height + 1;
         tmpRow++
         tmpCol = 0;
      }
      trace("Segment: " + (i + 1), ", x: " + seg1.x, ", y: " + seg1.y);
   }
         
   segX = startX;
   segY = startY;
         
   for (i = 0; i < (colNum * rowNum); i++) {
      if (tmpCol < colNum - 1) {
         seg2 = new BorderSeg();
         addChild(seg2);
         seg2.x = segX;
         seg2.y = segY;
         segX = seg2.x + seg2.width;
         tmpCol++
      } else if (tmpCol == colNum - 1) {
         segX = startX;
         segY = seg2.y + seg2.height;
         tmpCol = 0;
      }
   }
         
   boardSet = true;
}

The colNum variable (as you can see) is set to 11, which meas it should create a 11 x 8 grid, but for some reason it only generates a 10 x 8 grid. The last square in each row gets added at the same co-ordinates as the previous one to it in the same row.

Any thoughts on why that would be?