Agenda• Theory• Finding valid patterns and their states• Why Haskell?• If there’s time: – Animating siteswaps with HOpenGL – Type level siteswaps
Siteswap Notation• Encodes timing of throws• Ignores hand positions• E.g. – 3-ball cascade ‘3,3,3,3,…’ – 3-ball shower ‘5,1,5,1,…’ – 4-ball fountain ‘4,4,4,4,…’
Siteswap Notation• Hands alternate – Even numbers indicate throws to the same hand – Odd numbers indicate throws to the other hand• Current ball will be thrown again after N-1 beats• Period = length (* 2)• Number of props = average value• 0 is a pause with an empty hand
Space Time Diagrams• Tracks the orbit of each balls between the hands• Axes represent – Time – Ball position• Time axis is divided into beats
State Diagrams• Tracks when balls in the air will land• An × indicates a ball scheduled to land• A - indicates a free hand• E.g. – 3-ball cascade: ×××-- – 3-ball shower: ×-×-× → ××-×- → ×-×-× – 4-ball fountain: ××××-
State Diagrams• To “throw” a 0, shift the pattern to the left: – -×××- →0 ×××--• To throw to height N, shift and insert an × at the Nth place: – ×××-- →5 ××--×• State diagrams and heights form the vertices and edges of a directed graph.• Valid siteswaps are cycles in this graph.
State Diagrams ×××-- ××-×- -×××- ×-××-E.g. 3 props, maximum height 4
Translation Siteswap Space Time State DiagramPeriod Length (* 2) Tiling Period Cycle Length (* 2)# of Props Average # of Orbits # of ×’sHeight Value Horizontal Max node label Distance length
Why Haskell?• Type safety• Side effects are isolated• Succinct – Pattern matching – Polymorphism – Higher order functions
Code Break• Finding Valid Siteswaps• throw, throwMany, foldM• graph, generateGraph• E.g. all patterns decorating a 3-cascade• E.g. over combinator
HOpenGL• Provides a high-level interface to the OpenGL bindings.• Computations take place in IO• E.g. preservingMatrix :: IO a -> IO a• Use powerful existing tools, e.g. mapM
Code Break• Animating Siteswaps• IORef• E.g. insert
Type Level Siteswaps• Idea: Can we use the type system to identify valid siteswaps?• E.g. Can we improve on the type of (++) for concatenating patterns?• Use singleton types, type classes and fundeps to encode the state graph in the type system.