day8_common.carbon 650 B

12345678910111213141516171819202122232425262728
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. // https://adventofcode.com/2024/day/8
  5. library "day8_common";
  6. import Core library "io";
  7. import Core library "range";
  8. import library "io_utils";
  9. class Grid {
  10. impl as Core.UnformedInit {}
  11. fn Read() -> Grid {
  12. returned var me: Grid;
  13. for (y: i32 in Core.Range(50)) {
  14. for (x: i32 in Core.Range(50)) {
  15. me.data[x][y] = ReadChar() as i32;
  16. }
  17. SkipNewline();
  18. }
  19. return var;
  20. }
  21. var data: array(array(i32, 50), 50);
  22. }