Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Toy Alchemist (workshop)

The Toy Alchemist (workshop)

”The Toy Robot” is an interview exercise where you build a simulation of a toy robot moving around a square tabletop through a series of move commands. You can’t let the robot fall off the board!

In the workshop, we will build this game using the Elixir language and functional programming paradigms. We are not going to jump right in but rather start with the basics of Elixir and build up from there. Get a deep head start!

The implementation can be found at https://github.com/jwright/toy_alchemist

Elixir needs more alchemists.

Jamie Wright
PRO

May 25, 2023
Tweet

More Decks by Jamie Wright

Other Decks in Programming

Transcript

  1. TOY ALCHEMIST
    game program™
    Use with Workshop Wizards
    ELIXIR NDCOSLO

    View Slide

  2. Welcome

    View Slide

  3. Welcome.
    .
    .

    View Slide

  4. Jamie Wright
    background

    View Slide

  5. Jamie Wright
    background Proudly made
    in the 80’s

    View Slide

  6. Jamie Wright
    background Proudly made
    in the 80’s
    Started using
    Elixir in
    2014

    View Slide

  7. Jamie Wright
    background Proudly made
    in the 80’s
    Started using
    Elixir in
    2014
    Now building
    in it daily

    View Slide

  8. Jamie Wright
    background Proudly made
    in the 80’s
    Started using
    Elixir in
    2014
    Now building
    in it daily
    My favorite
    language

    View Slide

  9. Jamie Wright
    background Proudly made
    in the 80’s
    Started using
    Elixir in
    2014
    Now building
    in it daily
    Working on
    Juvet (OSS
    MVC chatbot
    framework)
    My favorite
    language

    View Slide

  10. Jamie Wright
    background
    @jwright
    [email protected]
    T
    g

    View Slide

  11. speakerdeck.com/jwright
    slides

    View Slide

  12. The TOY ROBOT
    storytime

    View Slide

  13. The TOY ROBOT
    storytime

    View Slide

  14. The TOY ROBOT
    storytime
    PLACE 2,3,EAST

    View Slide

  15. The TOY ROBOT
    storytime
    RIGHT

    View Slide

  16. The TOY ROBOT
    storytime
    MOVE

    View Slide

  17. The TOY ROBOT
    storytime
    MOVE

    View Slide

  18. The TOY ROBOT
    storytime
    MOVE

    View Slide

  19. The TOY ROBOT
    storytime
    LEFT

    View Slide

  20. The TOY ROBOT
    storytime
    MOVE

    View Slide

  21. The TOY ROBOT
    storytime
    AT 1,1 FACING WEST

    View Slide

  22. The TOY ROBOT
    storytime
    ALCHEMIST
    AT 1,1 FACING WEST
    🧙

    View Slide

  23. solution
    workshop
    github.com/jwright/toy_alchemist

    View Slide

  24. book
    workshop
    leanpub.com/elixir-toyrobot

    View Slide

  25. demo
    workshop

    View Slide

  26. Elixir
    background

    View Slide

  27. Elixir
    background

    View Slide

  28. Elixir
    background
    Erlang
    Released
    1986

    View Slide

  29. Elixir
    background
    Erlang
    Released
    BEAM
    1986 1992

    View Slide

  30. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    1986 1992 2012

    View Slide

  31. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    Phoenix
    Released
    1986 1992 2012 2015

    View Slide

  32. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    Phoenix
    Released
    LiveView
    1986 1992 2012 2015 2019

    View Slide

  33. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    Phoenix
    Released
    LiveView
    LiveBook
    1986 1992 2012 2015 2019 2021

    View Slide

  34. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    Phoenix
    Released
    LiveView
    LiveBook
    Nx
    1986 1992 2012 2015 2019 2021 2022

    View Slide

  35. Elixir
    background
    Erlang
    Released
    BEAM Elixir
    Released
    Phoenix
    Released
    LiveView
    LiveBook
    Nx
    Bumblebee
    1986 1992 2012 2015 2019 2021 2022

    View Slide

  36. Functional
    lesson

    View Slide

  37. Functional
    lesson

    View Slide

  38. Functional
    lesson

    View Slide

  39. Modules + Functions
    lesson

    View Slide

  40. Modules + Functions
    lesson
    Module

    View Slide

  41. Modules + Functions
    lesson
    Functions
    Module

    View Slide

  42. lesson
    Mix

    View Slide

  43. lesson
    Mix

    View Slide

  44. lesson
    Mix

    View Slide

  45. lesson
    Mix

    View Slide

  46. Create the project
    workshop

    View Slide

  47. ExUnit
    lesson

    View Slide

  48. Break down the problem
    workshop

    View Slide

  49. Maps
    lesson

    View Slide

  50. Structs
    lesson

    View Slide

  51. Structs
    lesson
    Struct

    View Slide

  52. Structs vs. Maps
    lesson

    View Slide

  53. Structs vs. Maps
    lesson

    View Slide

  54. Structs vs. Maps
    lesson

    View Slide

  55. Pattern Matching
    lesson

    View Slide

  56. Pipe operator
    lesson

    View Slide

  57. Pipe operator
    lesson

    View Slide

  58. Pipe operator
    lesson

    View Slide

  59. Docs + Doctest
    lesson

    View Slide

  60. Case statement
    lesson

    View Slide

  61. Tuples
    lesson

    View Slide