From 252c7398925b5267963c1a48251cd7ba2d4ec381 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 25 Jan 2018 15:20:54 +0000 Subject: Refactor game_state & cache to remove static hack --- src/main/game/pile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/game/pile.h') diff --git a/src/main/game/pile.h b/src/main/game/pile.h index 411f890..2bf2d5b 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -12,6 +12,7 @@ #include "card.h" class pile { + friend class hasher; public: typedef uint8_t size_type; @@ -33,7 +34,6 @@ public: card operator[] (size_type) const; friend bool operator==(const pile&, const pile&); - friend std::size_t hash_value(pile const&); private: // Underlying vector std::vector pile_vec; -- cgit v1.2.1 From 583b9a005ebd447d39c0515e2692178cc1dfe7b9 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 30 Jan 2018 15:49:28 +0000 Subject: Update card & pile with comp operators for sorting --- src/main/game/pile.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main/game/pile.h') diff --git a/src/main/game/pile.h b/src/main/game/pile.h index 2bf2d5b..4256b02 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -13,6 +13,7 @@ class pile { friend class hasher; + friend class game_state; public: typedef uint8_t size_type; @@ -25,16 +26,20 @@ public: bool empty() const; size_type size() const; - // Modify - void place(card); - card take(); - // Indexes the vector, with the top card as index 0 card& operator[] (size_type); card operator[] (size_type) const; friend bool operator==(const pile&, const pile&); + friend bool operator<(const pile&, const pile&); + friend bool operator>(const pile&, const pile&); + friend bool operator<=(const pile&, const pile&); + friend bool operator>=(const pile&, const pile&); private: + // Modify + void place(card); + card take(); + // Underlying vector std::vector pile_vec; }; -- cgit v1.2.1