day10_common.carbon 628 B

1234567891011121314151617181920212223242526272829
  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/10
  5. library "day10_common";
  6. import Core library "io";
  7. import library "io_utils";
  8. class Terrain {
  9. fn Read() -> Terrain {
  10. returned var me: Terrain;
  11. var y: i32 = 0;
  12. while (y < 43) {
  13. var x: i32 = 0;
  14. while (x < 43) {
  15. me.height[x][y] = ReadChar() - 0x30;
  16. ++x;
  17. }
  18. SkipNewline();
  19. ++y;
  20. }
  21. return var;
  22. }
  23. var height: [[i32; 43]; 43];
  24. }