private Integer safetilesincorner(OthelloTile tile){
		int ret = 0;
		TileDirection ydir = tile.getNeighbor(TileDirection.Up) != null? TileDirection.Up : TileDirection.Down;
		TileDirection xdir = tile.getNeighbor(TileDirection.Left) != null? TileDirection.Left : TileDirection.Right;
		int ymax = 8;
		int ycount = 0;
		int yval = tile.y;
		int xval = tile.x;
		OthelloTile toConsider = tile;
		boolean xmatch;
		boolean ymatch;
		/* Move along the y-axis of the corner, adding 1 for each tile found of the same color.
		 *  When an unclaimed or opposite tile is found, the index becomes the edge tile for the 
		 *  next row's search.
		 */
		do{
			do {
				ymatch = toConsider.color == tile.color && toConsider.isClaimed;
				ycount++;
				if (ymatch)
					ret++;
				else
					ymax = yval;
				yval += ydir.ydiff;
				toConsider = game.board.getTile(xval , yval);
			} while (ymatch && ycount < ymax);
			xval += xdir.xdiff;	
			yval = tile.y;
			toConsider = game.board.getTile(xval , yval);
			xmatch = toConsider != null;
			if (xmatch)
				xmatch = toConsider.isClaimed && toConsider.color == tile.color;
			ycount = 0;
		} while (xmatch);
		return ret;
	}