Outline Our project Welcome to the functional paradigm of Haskell
Game programming in Haskell
Alexander Berntsen Stian A. Ellingsen September 18, 2013
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Game programming in Haskell Alexander Berntsen Stian A. Ellingsen - - PowerPoint PPT Presentation
Outline Our project Welcome to the functional paradigm of Haskell Game programming in Haskell Alexander Berntsen Stian A. Ellingsen September 18, 2013 Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell Outline Our project
Outline Our project Welcome to the functional paradigm of Haskell
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
f o r ( std : : vector<E n t i t i e s ∗>:: c o n s t i t e r a t o r ent = e n t i t i e s . begin ( ) ; ent != e n t i t i e s . end ( ) ; (∗ ent)−>handle ( event ) , ++ent ) ; Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Current game programming paradigms Solving those problems
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming /∗ ∗ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ∗ Filename : l o l . c ∗ D e s c r i p t i o n : This program p r i n t s ” h e l l o h e l l o h e l l o ” ∗ Version : 1.0 ∗ Created : 17/09/13 11:59:11 ∗ R e v i s i o n : none ∗ Compiler : gcc ∗ Author : Foo Bar ( foo@bar . com ) , ∗ O r g a n i z a t i o n : Fubaz , Inc . ∗ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ∗/ #i n c l u d e <s t d i o . h> #i f d e f GNUC # d e f i n e UNUSED( x ) UNUSED # # x a t t r i b u t e ( ( u n u s e d )) #e l s e # d e f i n e UNUSED( x ) UNUSED # # x #e n d i f #i f d e f GNUC # d e f i n e UNUSED FUNCTION( x ) a t t r i b u t e ( ( u n u s e d ) ) UNUSED # # x #e l s e # d e f i n e UNUSED FUNCTION( x ) UNUSED # # x #e n d i f i n t main ( i n t ∗UNUSED( argc ) , const char UNUSED( argv ) ) { i n t i ; char msg [ 6 ] = ” h e l l o ” ; f o r ( i = 0; i < 3 ; ++i ) { p r i n t f ( ”%s ” , msg ) ; } p r i n t f ( ”\n” ) ; } Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
OBTW THIS PROGRAM PRINTS HELLO HELLO HELLO TLDR HAI 1.2 CAN HAS STDIO? IM IN YR LOOP UPPIN YR VAR BOTH SAEM VAR AN 3 , O RLY? YA RLY, GTFO NO WAI, VAR, WTF? OMG 2 VISIBLE ”HELLO” GTFO OMGWTF VISIBLE ”HELLO ”! OIC OIC IM OUTTA YR LOOP KTHXBYE Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
inPhoneBook : : [ Char ] − > [ Char ] − > [ ( [ Char ] , [ Char ] ) ] − > Bool inPhoneBook : : S t r i n g − > S t r i n g − > [ ( String , S t r i n g ) ] − > Bool inPhoneBook : : Name − > PhoneNumber − > PhoneBook − > Bool inPhoneBook n p b = elem (n , p ) b Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
1No known relation to any right-wing religious extremist Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming
Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time − − D i s p l a y twice the number
seconds passed + 10 l a b e l = 2∗ time + 10 Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time − − D i s p l a y twice the number
seconds passed + 10 l a b e l = 2∗ time + 10 − − D i s p l a y the s t r i n g ” yes ” i n a l a b e l l a b e l = ” yes ” Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time − − D i s p l a y twice the number
seconds passed + 10 l a b e l = 2∗ time + 10 − − D i s p l a y the s t r i n g ” yes ” i n a l a b e l l a b e l = ” yes ” − − D i s p l a y ” yes ” i f space key i s held down , ”no”
l a b e l = ” yes ” . keyDown Space <|> ”no” Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time − − D i s p l a y twice the number
seconds passed + 10 l a b e l = 2∗ time + 10 − − D i s p l a y the s t r i n g ” yes ” i n a l a b e l l a b e l = ” yes ” − − D i s p l a y ” yes ” i f space key i s held down , ”no”
l a b e l = ” yes ” . keyDown Space <|> ”no” − − D i s p l a y time w h i l e space i s pressed , ” Press space ”
l a b e l = fmap show time . keyDown Space <|> ” Press space ” Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell
Outline Our project Welcome to the functional paradigm of Haskell Declarative programming Haskell Functional reactive programming − − D i s p l a y c u r r e n t time i n a l a b e l l a b e l = time − − D i s p l a y twice the number
seconds passed + 10 l a b e l = 2∗ time + 10 − − D i s p l a y the s t r i n g ” yes ” i n a l a b e l l a b e l = ” yes ” − − D i s p l a y ” yes ” i f space key i s held down , ”no”
l a b e l = ” yes ” . keyDown Space <|> ”no” − − D i s p l a y time w h i l e space i s pressed , ” Press space ”
l a b e l = fmap show time . keyDown Space <|> ” Press space ” − − D i s p l a y ” yes ”/”no” e v e r y
second l a b e l = ” yes ” . holdFor 1 ( p e r i o d i c a l l y 2 <|> ”no” ) Alexander Berntsen, Stian A. Ellingsen Game programming in Haskell