fork download
  1. ConsoleController.prototype.strCellToObjCell = function(strCell) {
  2. if (typeof strCell != "string") {
  3. throw new ConsoleControllerException("Неправильный тип аргумента strCell. Ожидается" +
  4. "String. Получен: " + typeof strCell);
  5. }
  6. var regex = new RegExp("^\\w(\\d){1," + Util.getNumberLength(this._minesweeperGame.MAX_HEIGHT) + "}$", "i");
  7. if (strCell.search(regex) == -1) {
  8. throw new ConsoleControllerException("Неправильный вид аргумента strCell.")
  9. }
  10. var widthList = 'abcdefghijklmnopqrstuvwxyz'.slice(0, this._minesweeperGame.getWidth() - 1);
  11. //Отсчет клеток начинается с единицы, а не с нуля, если что
  12. var x = widthList.indexOf(strCell.slice(0, 1)) + 1;
  13. var y = +strCell.slice(1);
  14. if (x == -1 ||
  15. y < 1 ||
  16. y > this._minesweeperGame.getHeight()) {
  17. throw new ConsoleControllerException("Клетка " + strCell + " не существует.");
  18. }
  19. return new Cell(x, y);
  20. };
Runtime error #stdin #stdout #stderr 0.12s 51128KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
/home/2ZJYvZ/prog.js:1
(function (exports, require, module, __filename, __dirname) { ConsoleControlle
                                                              ^
ReferenceError: ConsoleController is not defined
    at Object.<anonymous> (/home/2ZJYvZ/prog.js:1:63)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3