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