blueberry

joined 2 weeks ago
MODERATOR OF
1
submitted 12 hours ago* (last edited 11 hours ago) by blueberry@feddit.org to c/ai_detox@feddit.org
 

Problem 3

(*) Find the K'th element of a list. Solutions

The first element in the list is number 1. Example:

* (element-at '(a b c d e) 3)
c

Example in Haskell:

elementAt [1,2,3] 2

2

elementAt "haskell" 5

'e'

[โ€“] blueberry@feddit.org 2 points 2 days ago

Really cool ๐Ÿ‘

1
submitted 2 days ago* (last edited 2 days ago) by blueberry@feddit.org to c/ai_detox@feddit.org
 

Problem 2

(*) Find the last-but-one (or second-last) element of a list.

(Note that the Lisp transcription of this problem is incorrect.)

Example in Haskell:

myButLast [1,2,3,4]

3

myButLast ['a'..'z']

'y'

Source: https://wiki.haskell.org/index.php?title=99_questions%2F1_to_10

2
submitted 2 days ago* (last edited 2 days ago) by blueberry@feddit.org to c/ai_detox@feddit.org
 

Problem 2

(*) Find the last-but-one (or second-last) element of a list. Solutions

(Note that the Lisp transcription of this problem is incorrect.)

Example in Haskell:

myButLast [1,2,3,4]

3

myButLast ['a'..'z']

'y'

[โ€“] blueberry@feddit.org 2 points 2 days ago (2 children)

Yeah, it's great, it's both gentle and powerful

2
submitted 4 days ago* (last edited 4 days ago) by blueberry@feddit.org to c/ai_detox@feddit.org
 

Problem 1

(*) Find the last element of a list. Solutions

(Note that the Lisp transcription of this problem is incorrect.)

Example in Haskell:

myLast [1,2,3,4]

4

myLast ['x','y','z']

'z'

[โ€“] blueberry@feddit.org 2 points 4 days ago

Yes, you're correct :)

 
[โ€“] blueberry@feddit.org 2 points 1 week ago* (last edited 1 week 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 :)

[โ€“] blueberry@feddit.org 2 points 1 week ago* (last edited 1 week ago) (2 children)

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]
[โ€“] blueberry@feddit.org 2 points 1 week ago (3 children)

You are right. My bad. Congratulations :)

[โ€“] blueberry@feddit.org 1 points 1 week ago (5 children)

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?

 

cross-posted from: https://feddit.org/post/14593429

Factorial Calculator

Difficulty: Expert

Game Overview

Design a physical track where a marble rolls and executes programming instructions. The marble carries a value and performs calculations as it hits different track pieces.

Puzzle

Calculate the factorial of 4 (4! = 4 ร— 3 ร— 2 ร— 1) and output the result 24.

Starting Conditions:

  • Marble begins carrying the value: 4
  • Expected output: 24

Available Track Pieces (Use Each Once):

  • 2ร— CURVE - Changes marble direction 90ยฐ
  • 1ร— STRAIGHT - Continues marble in same direction
  • 1ร— LOOP-TRACK - Connects track to form a physical loop
  • 1ร— BRANCH-ZERO - Marble goes LEFT if carrying 0, RIGHT otherwise
  • 1ร— SUBTRACT-1 - Subtracts 1 from marble's value
  • 1ร— MULTIPLY - Multiplies marble's value by memory slot A
  • 1ร— STORE-A - Saves marble's current value to memory slot A
  • 1ร— LOAD-A - Loads value from memory slot A into marble
  • 1ร— OUTPUT - Displays marble's current value
  • 1ร— HALT - Stops the marble

Rules:

  • Arrange all track pieces to create a complete path
  • Marble executes instructions when rolling over pieces
  • Design must calculate factorial using the loop mechanism
  • Marble must output 24 and then halt

Goal

The marble completes its journey, outputs 24, and stops.

 

Factorial Calculator

Difficulty: Expert

Game Overview

Design a physical track where a marble rolls and executes programming instructions. The marble carries a value and performs calculations as it hits different track pieces.

Puzzle

Calculate the factorial of 4 (4! = 4 ร— 3 ร— 2 ร— 1) and output the result 24.

Starting Conditions:

  • Marble begins carrying the value: 4
  • Expected output: 24

Available Track Pieces (Use Each Once):

  • 2ร— CURVE - Changes marble direction 90ยฐ
  • 1ร— STRAIGHT - Continues marble in same direction
  • 1ร— LOOP-TRACK - Connects track to form a physical loop
  • 1ร— BRANCH-ZERO - Marble goes LEFT if carrying 0, RIGHT otherwise
  • 1ร— SUBTRACT-1 - Subtracts 1 from marble's value
  • 1ร— MULTIPLY - Multiplies marble's value by memory slot A
  • 1ร— STORE-A - Saves marble's current value to memory slot A
  • 1ร— LOAD-A - Loads value from memory slot A into marble
  • 1ร— OUTPUT - Displays marble's current value
  • 1ร— HALT - Stops the marble

Rules:

  • Arrange all track pieces to create a complete path
  • Marble executes instructions when rolling over pieces
  • Design must calculate factorial using the loop mechanism
  • Marble must output 24 and then halt

Goal

The marble completes its journey, outputs 24, and stops.

 

cross-posted from: https://feddit.org/post/14591777

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.

[โ€“] blueberry@feddit.org 1 points 1 week ago

Good classification of different degrees of decentrality for machine learning: https://arxiv.org/pdf/2306.01603

[โ€“] blueberry@feddit.org 1 points 1 week ago* (last edited 1 week ago)
view more: next โ€บ