File: internal_move_struct.h

package info (click to toggle)
freecell-solver 3.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,864 kB
  • ctags: 3,658
  • sloc: ansic: 34,721; perl: 12,320; xml: 5,999; python: 1,149; sh: 965; ruby: 347; cpp: 304; makefile: 151
file content (108 lines) | stat: -rw-r--r-- 4,581 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* Copyright (c) 2000 Shlomi Fish
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
/*
 * internal_move_struct.h - header file for the internal move structure
 * of Freecell Solver.
 *
 * This file is not exposed to the outside.
 *
 */

#ifndef FC_SOLVE__INTERNAL_MOVE_STRUCT_H
#define FC_SOLVE__INTERNAL_MOVE_STRUCT_H

#include "fcs_move.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "config.h"

#ifdef FCS_USE_COMPACT_MOVE_TOKENS
typedef struct
{
    /*  TODO : Change to log_2 (
     *      max(MAX_NUM_FREECELLS, MAX_NUM_STACKS, MAX_NUM_DECKS * 4)
     *  ) */
    unsigned int type : 4;
    unsigned int src : 4;
    unsigned int dest : 4;
    unsigned int num_cards_in_seq : 4;
} fcs_internal_move_t;
#else
typedef fcs_move_t fcs_internal_move_t;
#endif

#ifdef FCS_USE_COMPACT_MOVE_TOKENS
#define fcs_int_move_set_src_stack(move,value)        (move).src = ((unsigned int)(value));
#define fcs_int_move_set_src_freecell(move,value)     (move).src = ((unsigned int)(value));
#define fcs_int_move_set_dest_stack(move,value)       (move).dest = ((unsigned int)(value));
#define fcs_int_move_set_dest_freecell(move,value)    (move).dest = ((unsigned int)(value));
#define fcs_int_move_set_foundation(move,value)       (move).dest = ((unsigned int)(value));
#define fcs_int_move_set_type(move,value)             (move).type = ((unsigned int)(value));
#define fcs_int_move_set_num_cards_in_seq(move,value) (move).num_cards_in_seq = ((unsigned int)(value));
#define fcs_int_move_set_num_cards_flipped(move,value) (move).num_cards_in_seq = ((unsigned int)(value));

#define fcs_int_move_get_src_stack(move)              ((move).src)
#define fcs_int_move_get_src_freecell(move)           ((move).src)
#define fcs_int_move_get_dest_stack(move)             ((move).dest)
#define fcs_int_move_get_dest_freecell(move)          ((move).dest)
#define fcs_int_move_get_foundation(move)             ((move).dest)
#define fcs_int_move_get_type(move)                   ((move).type)
#define fcs_int_move_get_num_cards_in_seq(move)       ((move).num_cards_in_seq)

#else /* Not FCS_USE_COMPACT_MOVE_TOKENS */

#define fcs_int_move_set_src_stack(move,value) fcs_move_set_src_stack((move),(value))
#define fcs_int_move_set_src_freecell(move,value) fcs_move_set_src_freecell((move),(value))
#define fcs_int_move_set_dest_stack(move,value) fcs_move_set_dest_stack((move),(value))
#define fcs_int_move_set_dest_freecell(move,value) fcs_move_set_dest_freecell((move),(value))
#define fcs_int_move_set_foundation(move,value) fcs_move_set_foundation((move),(value))
#define fcs_int_move_set_type(move,value) fcs_move_set_type((move),(value))
#define fcs_int_move_set_num_cards_in_seq(move,value) fcs_move_set_num_cards_in_seq((move),(value))
#define fcs_int_move_set_num_cards_flipped(move,value) fcs_move_set_num_cards_flipped((move),(value))

#define fcs_int_move_get_src_stack(move) fcs_move_get_src_stack((move))
#define fcs_int_move_get_src_freecell(move) fcs_move_get_src_freecell((move))
#define fcs_int_move_get_dest_stack(move) fcs_move_get_dest_stack((move))
#define fcs_int_move_get_dest_freecell(move) fcs_move_get_dest_freecell((move))
#define fcs_int_move_get_foundation(move) fcs_move_get_foundation((move))
#define fcs_int_move_get_type(move) fcs_move_get_type((move))
#define fcs_int_move_get_num_cards_in_seq(move) fcs_move_get_num_cards_in_seq((move))

#endif

typedef struct
{
    fcs_internal_move_t * moves;
    unsigned short num_moves;
} fcs_move_stack_t;

#ifdef __cplusplus
}
#endif

#endif  /* FC_SOLVE__INTERNAL_MOVE_STRUCT_H */