riccardotommasini / ppl

This repository contains the material related to the practical classes of the course Principles of Programming Languages
Apache License 2.0
29 stars 12 forks source link

BLACK JACK WITH COROUTINES, TRY-CATCH AND STRUCTS #14

Open riccardotommasini opened 5 years ago

riccardotommasini commented 5 years ago

Blackjack

A player consists of two elements 1) A data structure that contains the turn in hand (continuation), name and current score 2) a function/macro encapsulating the player behavior (why a macro, because I may want to standardize it as (play actions ... until conditions ... pass (yield) )

When a player reaches 21 set its status to winner When a player goes beyond 21 throws a loosing exception A player can yield the next turn The status of the game correspond to several co-routines representing the players the game stops, i.e., it must be re-evaluated (but cards remain the same) when a player wins

Interesting, implements the split when a player has two or more cards can split his/her game and proceed as it if what two players

riccardotommasini commented 5 years ago

UP