blueberry

joined 2 weeks ago
MODERATOR OF
1
submitted 3 days ago* (last edited 3 days 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 5 days ago

Really cool ๐Ÿ‘

1
submitted 5 days ago* (last edited 5 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 5 days ago* (last edited 5 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 5 days ago (2 children)

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

1
submitted 1 week ago* (last edited 1 week ago) by blueberry@feddit.org to c/ai_detox@feddit.org
2
submitted 1 week ago* (last edited 1 week 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 1 points 1 week ago

Oh, you're right.

 

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.

 

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 2 weeks ago

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

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