version: 0
type: calendar
id: mansupi-tachira-ripochya

cycles:
  - id: mochyu
    type: repeat
    offset: -1848581.25
    lengths:
      # These larger blocks significantlly speed up the processing of the the
      # calendar by letting us fast-forward through a block of years that have
      # a consistent length. The reason we have a larger calculations around
      # 1450 is that is where most of the writing is, so this has the most
      # performance.
      - count: 1600
        julian: 588600
      - count: 1456
        julian: 535626
      - count: 1440
        julian: 529740
      - count: 800
        julian: 294300
      - count: 160
        julian: 58860
      - count: 80
        julian: 29430
      - count: 16
        julian: 5886

      # Once we get to less than 16 years, we need to start going year-by-year.
      - count: 1
        julian: 365
        operation: mod
        ref: mochyu
        value: 16
      - count: 1
        julian: 366
        operation: mod
        ref: mochyu
        value: 8
      - count: 1
        julian: 367
        operation: mod
        ref: mochyu
        value: 4
      - count: 1
        julian: 369
    cycles:
      - id: mochyuRote
        type: repeat
        lengths:
          - count: 1
            julian: 1
      - id: mochyuRichi
        type: sequence
        lengths:
          - { count: 1, julian: 46 }
          - count: 1
            single:
              - julian: 46
                operation: mod
                ref: mochyu
                value: 4
              - julian: 47
          - { count: 1, julian: 47 }
          - count: 1
            single:
              - julian: 43
                operation: mod
                ref: mochyu
                value: 8
              - julian: 44
          - { count: 1, julian: 47 }
          - count: 1
            single:
              - julian: 45
                operation: mod
                ref: mochyu
                value: 16
              - julian: 46
          - { count: 1, julian: 45 }
          - count: 1
            single:
              - julian: 46
                operation: mod
                ref: mochyu
                value: 4
              - julian: 47
        cycles:
          - id: richiRote
            type: repeat
            lengths:
              - count: 1
                julian: 1
