Game Description:

PaperBugs is a puzzle where you control bugs on a grid by writing a simple program. Each bug executes the same program step-by-step to reach their targets. The key challenge is that ALL bugs run the SAME program simultaneously!

Puzzle:

Available instructions:

  • MOVE - move forward one cell
  • LEFT / RIGHT - rotate 90 degrees
  • IF FLOWER - execute next line only if flower ahead
  • IF EMPTY - execute next line only if path clear
  • IF WALL - execute next line only if wall ahead
  • IF GEM - execute next line only if gem ahead

Board:

Legend:

  • Flower (blocks movement)
  • Gem (collectable)
  • Wall (blocks movement)

Goal:

Write a single program that guides both bugs to collect gems and reach their targets safely.

  • Wrufieotnak@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    10 days ago

    Assuming LEFT means counterclockwise rotation, my solution would be:

    MOVE

    MOVE

    MOVE

    LEFT

    IF FLOWER: RIGHT

    RIGHT

    RIGHT

    IF FLOWER: LEFT

    LEFT

    MOVE -> should have reached the goal

    • blueberry@feddit.orgOPM
      link
      fedilink
      arrow-up
      1
      ·
      10 days ago

      That’s how it would play out:

      MOVE: MOVE: MOVE:

      [T1][B1][F][B2][T2]
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      LEFT:

      [T1][B1][F][B2][T2] (B1 and B2 face left)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      IF FLOWER: RIGHT

      [T1][B1][F][B2][T2] (Only true for B2)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      RIGHT

      [T1][B1][F][B2][T2] (B1 faces left, B2 faces up)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      RIGHT

      [T1][B1][F][B2][T2] (B1 faces up, B2 faces right)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      IF FLOWER: LEFT

      [T1][B1][F][B2][T2] (Doesn't apply for them both)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      LEFT

      [T1][B1][F][B2][T2] (B1 faces left, B2 faces up)
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      MOVE

      [B1][  ][F][B2][T2]
      [ ][G][ ][G][ ]
      [#][ ][#][ ][#]
      [ ][ ][F][ ][ ]
      [F][ ][ ][ ][F]
      

      No, that doesn’t do the trick. But thanks for trying it out ;) Maybe want to give it another try?

      • Wrufieotnak@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        10 days ago

        If I understand your output correctly, you missed the two steps with the IF statements. Or rather, I wrongly wrote it directly after the IFs, since the instruction stated “the next line”

        So here is the revised version:

        MOVE

        MOVE

        MOVE

        LEFT

        IF FLOWER:

        RIGHT

        RIGHT

        RIGHT

        IF FLOWER:

        lEFT

        LEFT

        MOVE -> should have reached the goal

        Also, shouldn’t they have collected the gems when walking over them?

          • blueberry@feddit.orgOPM
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            10 days ago

            Here the correct walk-through:

            MOVE: MOVE: MOVE:

            [T1][B1][F][B2][T2]
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            LEFT:

            [T1][B1][F][B2][T2] (B1 and B2 face left)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            IF FLOWER: RIGHT

            [T1][B1][F][B2][T2] (Only true for B2; B2 now faces up)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            RIGHT

            [T1][B1][F][B2][T2] (B1 faces up, B2 faces right)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            RIGHT

            [T1][B1][F][B2][T2] (B1 faces right, B2 faces down)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            IF FLOWER: LEFT

            [T1][B1][F][B2][T2] (Only applies for B1; now faces up)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            LEFT

            [T1][B1][F][B2][T2] (B1 faces left, B2 faces right)
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            

            MOVE

            [B1][  ][F][B2][T2]
            [ ][G][ ][G][ ]
            [#][ ][#][ ][#]
            [ ][ ][F][ ][ ]
            [F][ ][ ][ ][F]
            
            • Wrufieotnak@feddit.org
              link
              fedilink
              arrow-up
              1
              ·
              10 days ago

              Yipee =D

              Nice little challenge! But did you write the “images” yourself or did you use a program to create them? I’m not sure which way would be more work XD

              • blueberry@feddit.orgOPM
                link
                fedilink
                arrow-up
                2
                ·
                edit-2
                9 days ago

                Tbh I came up with idea of the game and then played around with Claude a bit. I will also try to come up with my own levels, but if the puzzle works and is good, I actually think AI can be a good assistant here. But yeah, I will try to invest more work of myself in it :)