Refactored jokers stack to be a list (AI used)

This commit is contained in:
MeirGavish
2025-08-16 13:18:44 +03:00
parent bc8847d2cb
commit 92fa279059
4 changed files with 44 additions and 37 deletions
+7 -3
View File
@@ -2,6 +2,7 @@
#include "joker.h"
#include "util.h"
#include "hand_analysis.h"
#include "list.h"
#include <stdlib.h>
static JokerEffect default_joker_effect(Joker *joker, Card *scored_card) {
@@ -191,16 +192,19 @@ static JokerEffect joker_stencil_effect(Joker *joker, Card *scored_card) {
if (scored_card != NULL)
return effect; // if card != null, we are not at the end-phase of scoring yet
List* jokers = get_jokers();
// +1 xmult per empty joker slot...
int num_jokers = get_jokers_top() + 1;
int num_jokers = list_get_size(jokers);
effect.xmult = (MAX_JOKERS_HELD_SIZE) - num_jokers;
// ...and also each stencil_joker adds +1 xmult
JokerObject** jokers = get_jokers();
for (int i = 0; i < num_jokers; i++ )
{
if (jokers[i]->joker->id == JOKER_STENCIL_ID)
JokerObject* joker_object = list_get(jokers, i);
if (joker_object->joker->id == JOKER_STENCIL_ID)
effect.xmult++;
}