Pass the Parcel - PowerPoint PPT Presentation

About This Presentation
Title:

Pass the Parcel

Description:

Pass the Parcel. specification game[preparetopass12,pass12,preparetopass23,pass23, ... ofsort Parcel. Uuwrap(add(p)) = p; unwrap(new) = new; initial = wrap(wrap ... – PowerPoint PPT presentation

Number of Views:232
Avg rating:3.0/5.0
Slides: 5
Provided by: Muf7
Category:
Tags: parcel | pass

less

Transcript and Presenter's Notes

Title: Pass the Parcel


1
Pass the Parcel
  • specification gamepreparetopass12,pass12,preparet
    opass23,pass23,
    preparetopass34,pass34,preparetopass41,pass41,
    musicstop,musicstart,present
    exit( Pass the Parcel Game )( M.
    Calder 1999 )( represent passing by two
    eventspreparetopass and pass )( if music
    stops during passing, i.e. after prepare but
    before pass )( the intended recipient unwraps
    the parcel )library boolean endlib(
    )( The Parcel ADT
    )()type Parcel is
    booleansorts Parcelopns wrappers Parcel -gt
    bool new -gt Parcel add Parcel -gt
    Parcel unwrap Parcel -gtParcel
    initial Parceleqns forall pParcelofsort
    boolwrappers(new) falsewrappers(add(p))
    trueofsort ParcelUuwrap(add(p))
    punwrap(new) newinitial
    wrap(wrap(wrap(new))) endtype(
    )( Basic Player Process)(
    )process Playerpreparetoreceive,recei
    ve,preparetopass,pass,
    musicstop,musicstart,present(parcel?bool) exit
    parcel? -gt HasParcelpreparetorece
    ive,receive,preparetopass,pass,
    musicstop,musicstart,present(initial)
    not (parcel?) -gt (present exit
    HasnoParcelpreparetoreceive,receive,prepareto
    pass,pass, musicstop,musicstart,
    present)endproc

2
  • ()( Player Has Parcel
    )()process
    HasParcelprepr,receive,prepp,pass,stop,start,win
    (pParcel) exit ( p is the parcel )(
    music is playing, player is about to pass the
    parcel )( pass the parcel 3 possibilities
    )( i) pass the parcel interrupted by music
    stop )( ii) pass the parcel, no interruptions
    )( iii) music stops before parcel passing
    commences ) (prepp (stop pass!p
    ((win exit)
    (start HasnoParcelprepr,r
    eceive,prepp,pass,stop,start,win))
    (pass!p HasnoParcelprepr,receive,pre
    pp,pass,stop,start,win)))
    ( music stops before beginning to pass
    )( unwrap the parcel and win if no wrappers
    left ) (let newpParcel unwrap(p) in
    (stop i (not(wrappers(newp)) -gt
    (win exit) (start
    HasParcelprepr,receive,prepp,pass,stop,start,win
    (newp)))))endproc

3
  • ()( Player Does
    Not Have Parcel )(
    )process HasnoParcelprepr,receive,prepp,pass,st
    op,start,winexit ( music is playing,
    player is about receive the parcel )( receive
    the parcel 3 possibilities )( i) parcel
    passing interrupted by music stop, )(
    unwrap the parcel after receipt and exit if no
    wrappers left)( ii) receive the parcel, no
    interruptions )( iii) music stops before
    parcel passing commences) (prepr
    ((stop receive?pParcel i (let
    newpParcel unwrap(p) in
    (not(wrappers(newp)) -gt (win exit)
    (start HasParcelprepr,receive,pre
    pp,pass,stop,start,win(newp)))))
    (receive?pParcel HasParcelprepr,receive,
    prepp,pass,stop,start,win(p))))( music
    stops before parcel received )( don't actually
    receive anything ) (stop ((win exit)
    (start HasnoParcelprepr,re
    ceive,prepp,pass,stop,start,win)))endproc(
    )( Music
    )()proces
    s Musicstart,stop exit stop (exit
    start Musicstart,stop)endproc

4
  • ()( A Game
    with 4 Players )(
    )process FourPlayerpreparetopass12,pass12,
    preparetopass23,pass23,
    preparetopass34,pass34,preparetopass41,pass41,
    musicstop,musicstart,present
    exit (((Playerpreparetopass41,pass41
    ,preparetopass12,pass12,
    musicstop,musicstart,present(true)
    preparetopass12,pass12,musicstop,musicstart,pres
    entPlayerpreparetopass12,pass12,preparetopass
    23,pass23, musicstop,musicstart,present(fa
    lse)) preparetopass23,pass23,musicstop,musi
    cstart,presentPlayerpreparetopass23,pass23,pr
    eparetopass34,pass34, musicstop,musicstart,
    present(false))preparetopass34,pass34,perpare
    topass41,pass41,musicstop,musicstart,presentPl
    ayerpreparetopass34,pass34,preparetopass41,pass41
    , musicstop,musicstart,present(false)
    )musicstart,musicstop(musicstart
    Musicmusicstart,musicstop)endprocendspec 
Write a Comment
User Comments (0)
About PowerShow.com