Download presentation
Presentation is loading. Please wait.
Published byMariah Waters Modified over 9 years ago
1
Task Oriented Programming in using Rinus Plasmeijer – Bas Lijnse - Peter Achten Pieter Koopman - Steffen Michels - Jurriën Stutterheim Jan Martin Jansen (NLDA) - Laszlo Domoszlai (ELTE) LIGRETTO CASE STUDY 1
2
Ligretto (slightly simplified version) A card game for 2 upto 4 players Card attributes: numbered(1.. 10) front color(red, green, blue, yellow) back color(red, green, blue, yellow) Each player has 40 cards: of each color all possible 10 values 2
3
Ligretto: initial set-up (4 players) 3 middle 3 10 1 row 2 ligretto (10 cards) - hand (concealed, discard)
4
Ligretto: play the game 4 middle 3 10 1 row 2 ligretto (10 cards) - hand (concealed, discard) only cards from row and discard can be placed in middle new pile in middle starts with card value 1 on a middle pile only a card with same front color and value 1 higher can be placed cards taken from row are immediately replaced by top card from ligretto pile flip top 3 concealed cards to discard pile if concealed pile is empty, shuffle discard pile and move to concealed pile game ends as soon as first ligretto pile is empty
5
Getting started: ligretto.dcl :: NrOfPlayers:== Int :: Middle:== [Pile] :: Pile:== [Card] :: Card = { back:: Color, front:: Color, nr:: Int } :: SideUp = Front | Back :: Color = Red | Green | Blue | Yellow :: Player = { color:: Color, row:: Row, ligretto:: Pile, hand:: Hand } :: Row:== [Card] :: Hand = { conceal:: Pile, discard:: Pile } 5
6
Getting started: ligretto.dcl nr_of_cards_in_row:: NrOfPlayers-> Int colors:: NrOfPlayers-> [Color] initial_player:: NrOfPlayers Color Int-> Player row_card:: Int Player-> Card move_ligretto_card_to_row:: Int Player-> Player top_discard:: Player-> Maybe Card shuffle_hand:: Int Player-> Player remove_top_of_discard:: Player-> Player swap_discards:: Player-> Player card_matches_top_of_pile:: Card Pile-> Bool 6
7
Getting started: ligrettoTOP.icl view_card:: SideUp Card -> HtmlTag play_ligretto:: Task Color 7
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.