~/talk

Playing a Hand with Ruby Pattern Matching

Talkat rubyday 2021 · on Wednesday, 2021-04-07· [ruby]
slides:none on file

Code shows Ruby 2.7 pattern matching scoring poker hands by building Card and Hand classes, implementing deconstruct hooks, Comparable-based sorting, and one-liner match syntax. Examples use named captures and the pin operator, array destructuring, fine patterns and pinned ranks to detect royal flush down to high card. The talk ties predicates into a score map, runs the examples against sample hands, and the tests all pass, proving the approach works for this concrete problem.

AI-written summary · about

  1. 0:00Introduction
  2. 2:13Ruby pattern matching
  3. 4:42Card and hand structures
  4. 8:12Easy card creation
  5. 12:47Sorting cards and hands
  6. 15:13Poker hand types
  7. 22:31Scoring poker hands
  8. 29:14Beyond poker
  9. 30:58Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.