From 51249e4a13ee34d891f6f31eaf9654caeb57e49a Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 28 Mar 2021 11:16:58 +0200 Subject: [PATCH] Monopoly skeleton. --- 03_monopoly.txt | 177 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 03_monopoly.txt diff --git a/03_monopoly.txt b/03_monopoly.txt new file mode 100644 index 0000000..39f1f02 --- /dev/null +++ b/03_monopoly.txt @@ -0,0 +1,177 @@ + +Írni fogunk egy leegyszerűsített monopoly szerűséget. + + +class Tile + +String name; +virtual void player_arrived(Player *p); + + +---------- +class TaxTile : Tile + +int tax; +virtual void player_arrived(Player *p); + + +---------- +class OwnableTile : Tile + +int price; +int enter_price; +Player *owner; + +virtual void player_arrived(Player *p); +//ask player if he wnats to buy. +//if owned works like tax +//if owner steps on it, he gains enter_price + + +---------- +class GainTile : Tile + +int gain; +virtual void player_arrived(Player *p); + + +---------- +class LuckTile : Tile + +int chance; +int gain_min; +int gain_max; +virtual void player_arrived(Player *p); + + +---------- +class JailTile : Tile + +int jail_time; +virtual void player_arrived(Player *p); + + + +---------- + +class Player + +String name; +int tile_index; +int money; +int jail_time; +bool _lost; + +virtual bool ask_buy(String name, int price); +virtual void pay_entry(int val, Player *to); +void pay_tax(int val); +void receive_payment(int val); +void lost(); +bool did_lose(); + +virtual void act(); +virtual int throw_dice(); +virtual void on_lose(); + + + + +---------- + +class AgressivePlayer : Player + +virtual void act(); + + + + +---------- + +class ConservativePlayer : Player + +virtual void act(); + + + +---------- + +class TrickyPlayer : Player + +virtual void act(); + + + +---------- + +class HumanPlayer : Player + +virtual void act(); +megkérdezi, hogy mit csináljon + + + +---------- + +class CheatingPlayer : Player + +int throw_result; + +virtual void act(); +virtual int throw_dice(); + + + +---------- + +class Board + +Vector players; +Vector tiles; +Vector lost_players; + +int current_player; + +void step(); +bool is_finished(); +void print_results(); + +void load_tile_file(String f); +void load_player_setup_file(String f); + + + + +step(): + +current player -> throw dice -> wrap index -> get tile -> tile->player_arrived(p) -> if did_lose() remove from game, add to lost_players + +current_player++; and wrap; + + + + + +------------ + +main() { + Board(); + Board.load_tile_file(); + Board.load_player_setup_file(); + + //esetleg kerdezhet + + while (!board.is_finished()) { + board.step(); + + sleep 1s + } + + board.print_results(); + ret 0; +} + +print_results(): + +1. place, 2nd place print etc. + +