day10_common.carbon 633 B

1234567891011121314151617181920212223242526
  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 Core library "range";
  8. import library "io_utils";
  9. class Terrain {
  10. fn Read() -> Terrain {
  11. returned var me: Terrain;
  12. for (y: i32 in Core.Range(43)) {
  13. for (x: i32 in Core.Range(43)) {
  14. me.height[x][y] = ReadChar() - 0x30;
  15. }
  16. SkipNewline();
  17. }
  18. return var;
  19. }
  20. var height: array(array(i32, 43), 43);
  21. }