text: #include <fstream>
  #include <iostream>
  #include <sstream>
  #include <string>
  #include <vector>
  using std::cout;
  using std::ifstream;
  using std::istringstream;
  using std::string;
  using std::vector;
  
  enum class State {kEmpty, kObstacle};
  
  // Note: the return type can also be "auto"
  vector<State> ParseLine(string line) {
      istringstream sline(line);
      int n;
      char c;
      vector<State> row;
      while (sline >> n >> c && c == ',') {
        switch(n) {
          case 0: row.push_back(State::kEmpty);
            break;
          case 1: row.push_back(State::kObstacle);
            break;
        }
      }
  
      return row;
  }
  
  vector<vector<State>> ReadBoardFile(string path) {
    ifstream myfile (path);
    vector<vector<State>> board{};
    if (myfile) {
      string line;
      while (getline(myfile, line)) {
        vector<State> row = ParseLine(line);
        board.push_back(row);
      }
    }
    return board;
  }
  
  string CellString(State cell) {
    switch(cell) {
      case State::kObstacle: return "⛰   ";
      default: return "0   "; 
    }
  }
  
  void PrintBoard(const vector<vector<State>> board) {
    for (int i = 0; i < board.size(); i++) {
      for (int j = 0; j < board[i].size(); j++) {
        cout << CellString(board[i][j]);
      }
      cout << "\n";
    }
  }
  
  int main() {
    auto board = ReadBoardFile("1.board");
    PrintBoard(board);
  }