Artwork

Content provided by Steve. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Steve or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

STT e47: Ruby is Great

56:19
 
Share
 

Fetch error

Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on September 27, 2024 21:14 (11M ago)

What now? This series will be checked again in the next day. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.

Manage episode 328549943 series 3301238
Content provided by Steve. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Steve or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.

Hey folks!
This week I talk about Ruby, which is one of my Top 3 favorite programming languages (if you count "Lisp" as a single language), the third being Kotlin.
If you want to get straight to the hand-waving ranting, you can jump to around the 40 minute mark.
This week we're having a competition! We're going to re-do the Farmer, Dog, Chicken, Grain competition I held at Amazon.com around 18 years ago.
Sometime this week, if you have time, try writing a succinct and elegant solution to this problem, in the programming language of your choice, and post it here in the YT comment section.
The problem: A farmer (F) needs to get his dog (D), chicken (C) and bag of grain (G) across a river. He has a boat that allows him to carry exactly zero or one item across with him. Write a program that spits out a solution when you run the program with no input/arguments.
Example solution that your program might output:
carry chicken
carry nothing
carry grain
carry chicken
carry dog
carry nothing
carry chicken

You can model it however you like. Below I present an abstract model of the states of the system as it carries out the steps above, where | represents the river. Things on the left bank and right banks are placed before/after the '|', respectively:
FDCG| - start state, everyone on left; carry chicken to right bank
DG|FC - FC now on right; carry nothing back
FDG|C - FDG on left; carry grain
D|FCG - FCG on right; carry chicken back
FCD|G - FDC on left; carry dog
C|FDG - chicken on left; carry nothing back
FC|DG - FC on left; carry chicken across
|FDCG - end state
Keep in mind that your program must perform a SEARCH through the possible move space for a solution, and you cannot have any third-party library dependencies; only what the language provides built in with its distribution.
I am looking for solutions that are ELEGANT, by which I mean, short and to the point: ideally, without boilerplate or other stuff unrelated to the algorithm. This is a self-contained program and will not grow, so keep it small! Do not over-engineer it!
I will submit solutions in at least Ruby and Elisp, though you are welcome to do the same. But I'd like to see a variety of languages here! Multiple submissions are fine as well. This is a fun little problem to solve.
Most languages let you solve this problem in 20-30 lines of code or less.
I'll take solutions through next Saturday and then do the judging in Sunday's episode. Though of course you are all welcome to keep submitting solutions after I do the judging, and I can comment on them below.
Have fun!
Podcast listeners, you should participate as well! Just head over to my YT channel to comment with your solution.
NOTE: I may update this comment with a shared link if we can find a reasonable place to do this. Maybe someone can create a subreddit or Discourse or something?

  continue reading

53 episodes

Artwork
iconShare
 

Fetch error

Hmmm there seems to be a problem fetching this series right now. Last successful fetch was on September 27, 2024 21:14 (11M ago)

What now? This series will be checked again in the next day. If you believe it should be working, please verify the publisher's feed link below is valid and includes actual episode links. You can contact support to request the feed be immediately fetched.

Manage episode 328549943 series 3301238
Content provided by Steve. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Steve or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://ppacc.player.fm/legal.

Hey folks!
This week I talk about Ruby, which is one of my Top 3 favorite programming languages (if you count "Lisp" as a single language), the third being Kotlin.
If you want to get straight to the hand-waving ranting, you can jump to around the 40 minute mark.
This week we're having a competition! We're going to re-do the Farmer, Dog, Chicken, Grain competition I held at Amazon.com around 18 years ago.
Sometime this week, if you have time, try writing a succinct and elegant solution to this problem, in the programming language of your choice, and post it here in the YT comment section.
The problem: A farmer (F) needs to get his dog (D), chicken (C) and bag of grain (G) across a river. He has a boat that allows him to carry exactly zero or one item across with him. Write a program that spits out a solution when you run the program with no input/arguments.
Example solution that your program might output:
carry chicken
carry nothing
carry grain
carry chicken
carry dog
carry nothing
carry chicken

You can model it however you like. Below I present an abstract model of the states of the system as it carries out the steps above, where | represents the river. Things on the left bank and right banks are placed before/after the '|', respectively:
FDCG| - start state, everyone on left; carry chicken to right bank
DG|FC - FC now on right; carry nothing back
FDG|C - FDG on left; carry grain
D|FCG - FCG on right; carry chicken back
FCD|G - FDC on left; carry dog
C|FDG - chicken on left; carry nothing back
FC|DG - FC on left; carry chicken across
|FDCG - end state
Keep in mind that your program must perform a SEARCH through the possible move space for a solution, and you cannot have any third-party library dependencies; only what the language provides built in with its distribution.
I am looking for solutions that are ELEGANT, by which I mean, short and to the point: ideally, without boilerplate or other stuff unrelated to the algorithm. This is a self-contained program and will not grow, so keep it small! Do not over-engineer it!
I will submit solutions in at least Ruby and Elisp, though you are welcome to do the same. But I'd like to see a variety of languages here! Multiple submissions are fine as well. This is a fun little problem to solve.
Most languages let you solve this problem in 20-30 lines of code or less.
I'll take solutions through next Saturday and then do the judging in Sunday's episode. Though of course you are all welcome to keep submitting solutions after I do the judging, and I can comment on them below.
Have fun!
Podcast listeners, you should participate as well! Just head over to my YT channel to comment with your solution.
NOTE: I may update this comment with a shared link if we can find a reasonable place to do this. Maybe someone can create a subreddit or Discourse or something?

  continue reading

53 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide

Copyright 2025 | Privacy Policy | Terms of Service | | Copyright
Listen to this show while you explore
Play