From d5f5a025234a4fe777a4ee9af73ff06fc64b9d03 Mon Sep 17 00:00:00 2001 From: Matuush Date: Tue, 5 Nov 2024 11:53:24 +0100 Subject: [PATCH] Get all possible colors for all positions --- gamestate.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gamestate.hpp b/gamestate.hpp index 842075a..a413bb3 100644 --- a/gamestate.hpp +++ b/gamestate.hpp @@ -45,7 +45,7 @@ public: return -1; } - // Print known information + // Get known information void print() { cout << " "; for(int col = 0; col < M; col++) @@ -58,6 +58,15 @@ public: cout << std::endl;; } } + // Get all possible colors for all positions + vector> list_all_possibilities() { + auto r = vector>(N, vector(0)); + for(int col = 0; col < M; col++) + for(int n = 0; n < N; n++) + if(possible[n][col]) + r[col].push_back(n); + return r; + } }; // For remembering guesses with their responses