- const res = /^([a-z]+)([0-9]+)$/i.exec(squares[i]);
- const x = sizeX - parseInt(res[2]); //white at bottom, so counting is reversed
- const y = res[1].charCodeAt(0)-97; //always one char: max 26, big enough
- markArray[x][y] = true;
+ const coords = V.SquareToCoords(squares[i]);
+ markArray[coords.x][coords.y] = true;
+ }
+ }
+ let shadowArray = [];
+ if (!!args.shadow && args.shadow != "-")
+ {
+ // Turn (human) shadow indications into coordinates
+ shadowArray = doubleArray(sizeX, sizeY, false);
+ let squares = args.shadow.split(",");
+ for (let i=0; i<squares.length; i++)
+ {
+ const rownum = V.size.x - parseInt(squares[i]);
+ if (!isNaN(rownum))
+ {
+ // Shadow a full row
+ for (let i=0; i<V.size.y; i++)
+ shadowArray[rownum][i] = true;
+ continue;
+ }
+ if (squares[i].length == 1)
+ {
+ // Shadow a full column
+ const colnum = V.ColumnToCoord(squares[i]);
+ for (let i=0; i<V.size.x; i++)
+ shadowArray[i][colnum] = true;
+ continue;
+ }
+ // Shadow just one square:
+ const coords = V.SquareToCoords(squares[i]);
+ shadowArray[coords.x][coords.y] = true;