1 // This file is part of Freecell Solver. It is subject to the license terms in 2 // the COPYING.txt file found in the top-level directory of this distribution 3 // and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of 4 // Freecell Solver, including this file, may be copied, modified, propagated, 5 // or distributed except according to the terms contained in the COPYING file. 6 // 7 // Copyright (c) 2000 Shlomi Fish 8 // game_type_params.h: provide fcs_game_type_params_t 9 #pragma once 10 11 #include "game_type_limit.h" 12 13 #ifndef FCS_FREECELL_ONLY 14 typedef struct 15 { 16 #endif 17 // The number of Freecells, Stacks and Foundations present in the game. 18 // 19 // freecells_num and stacks_num are variable and may be specified at 20 // the beginning of the execution of the algorithm. However, there 21 // is a maximal limit to them which is set in config.h. 22 // 23 // decks_num can be 1 or 2 . 24 25 #define SET_INSTANCE_GAME_PARAMS(instance) const_SLOT(game_params, instance) 26 27 #define SET_GAME_PARAMS() SET_INSTANCE_GAME_PARAMS(instance) 28 29 #ifndef HARD_CODED_NUM_FREECELLS 30 fcs_game_limit freecells_num; 31 #define INSTANCE_FREECELLS_NUM (instance->game_params.freecells_num) 32 #define LOCAL_FREECELLS_NUM (game_params.freecells_num) 33 #else 34 #define INSTANCE_FREECELLS_NUM HARD_CODED_NUM_FREECELLS 35 #define LOCAL_FREECELLS_NUM HARD_CODED_NUM_FREECELLS 36 #endif 37 38 #ifndef HARD_CODED_NUM_STACKS 39 fcs_game_limit stacks_num; 40 #define INSTANCE_STACKS_NUM (instance->game_params.stacks_num) 41 #define LOCAL_STACKS_NUM (game_params.stacks_num) 42 #else 43 #define INSTANCE_STACKS_NUM HARD_CODED_NUM_STACKS 44 #define LOCAL_STACKS_NUM HARD_CODED_NUM_STACKS 45 #endif 46 47 #ifndef HARD_CODED_NUM_DECKS 48 fcs_game_limit decks_num; 49 #define INSTANCE_DECKS_NUM (instance->game_params.decks_num) 50 #define LOCAL_DECKS_NUM (game_params.decks_num) 51 #else 52 #define INSTANCE_DECKS_NUM HARD_CODED_NUM_DECKS 53 #define LOCAL_DECKS_NUM HARD_CODED_NUM_DECKS 54 #endif 55 56 #ifdef FCS_FREECELL_ONLY 57 #define GET_INSTANCE_SEQUENCES_ARE_BUILT_BY(instance) \ 58 FCS_SEQ_BUILT_BY_ALTERNATE_COLOR 59 #else 60 // sequences_are_built_by - (bits 0:1) - what two adjacent cards in the 61 // same sequence can be. 62 // 63 // empty_stacks_fill (bits 2:3) - with what cards can empty stacks be 64 // filled with. 65 // 66 // unlimited_sequence_move - (bit 4) - whether an entire sequence can be 67 // moved from one place to the other regardless of the number of 68 // unoccupied Freecells there are. 69 fcs_game_limit game_flags; 70 71 #define INSTANCE_GAME_FLAGS (instance->game_params.game_flags) 72 #define GET_INSTANCE_SEQUENCES_ARE_BUILT_BY(instance) \ 73 ((instance)->game_params.game_flags & 0x3) 74 75 #define INSTANCE_UNLIMITED_SEQUENCE_MOVE (INSTANCE_GAME_FLAGS & (1 << 4)) 76 #define INSTANCE_EMPTY_STACKS_FILL ((INSTANCE_GAME_FLAGS >> 2) & 0x3) 77 78 #endif 79 #if ((!defined(HARD_CODED_NUM_FREECELLS)) || (!defined(HARD_CODED_NUM_STACKS))) 80 #define FC__STACKS__SET_PARAMS() SET_GAME_PARAMS() 81 #else 82 #define FC__STACKS__SET_PARAMS() 83 #endif 84 #ifndef HARD_CODED_NUM_STACKS 85 #define STACKS__SET_PARAMS() SET_GAME_PARAMS() 86 #else 87 #define STACKS__SET_PARAMS() 88 #endif 89 #ifndef FCS_FREECELL_ONLY 90 } fcs_game_type_params; 91 #endif 92