Permalink
Switch branches/tags
v2_4_2@3681 v2_4_2@5 v2_4_2@3 v2_4_2 releases@3681 releases prepare-depth-dbm-fc-solve-for-amazon-aws--two-remaining-4fc-deals--take1--2016-12-26 prepare-depth-dbm-fc-solve-for-amazon-aws--take1--2016-11-04 latest-devel@3681 latest-devel@737 latest-devel@619 latest-devel@573 latest-devel gcc-4.5-slowdown-Before@3681 gcc-4.5-slowdown-Before@2947 gcc-4.5-slowdown-Before@2910 gcc-4.5-slowdown-Before@2909 gcc-4.5-slowdown-Before gcc-4.5-slowdown-After@3681 gcc-4.5-slowdown-After@2949 gcc-4.5-slowdown-After@2910 gcc-4.5-slowdown-After@2909 gcc-4.5-slowdown-After freecell-solver-4.20.0 freecell-solver-4.18.0 freecell-solver-4.16.0 freecell-solver-4.14.1 freecell-solver-4.14.0 freecell-solver-4.12.1 freecell-solver-4.12.0 freecell-solver-4.10.0 freecell-solver-4.8.0 freecell-solver-4.6.1 freecell-solver-4.6.0 freecell-solver-4.4.0 freecell-solver-4.2.0 freecell-solver-4.0.2 freecell-solver-4.0.1 freecell-solver-4.0.0 freecell-solver-3.27.0 freecell-solver-3.26.0 freecell-solver-3.24.0 freecell-solver-3.22.0 freecell-solver-3.21.5 freecell-solver-3.20.1 freecell-solver-3.20.0 freecell-solver-3.18.1 freecell-solver-3.18.0 freecell-solver-3.17.3-testsuite-and-rpmbuild-working-on-32-bit freecell-solver-3.16.0 freecell-solver-3.14.1 freecell-solver-3.14.0 freecell-solver-3.12.0 freecell-solver-3.11.0 depth_dbm_fc_solver_100M_4fc_intractables_for_Amadiro depth_dbm_fc_solver_100M_short_solutions_for_amadiro depth_dbm_fc_solver_100K_to_400k_run_with_500GB depth_dbm_fc_solver_100K_to_400k_run_with_500GB_with_fixed_avl_tree depth_dbm_fc_solver_100K_to_400k_run_with_500GB_take7 dbm_fcs_for_subanark.tar.gz dbm_fcs_for_amadiro-WITH_RAM_OPTIMISATIONS-try2.tar.gz dbm_fcs_for_amadiro-WITH_RAM_OPTIMISATIONS-try1.tar.gz dbm_fc_solver_32001_to_50000_tar.gz dbm_fc_solver_100K_to_400k.tar.gz dbm_fc_solver_100K_to_400k_run_with_500GB dbm_fc_solver_100K_to_400k_run_with_500GB_take4 dbm_fc_solver_100K_to_400k_run_with_127GB dbm_fc_solver_100K_to_400k-127GB-take2.tar.gz dbm_fc_solver_50K_to_100K_tar.gz before-remove-cmake-generated-files-in-dot-dir asciidoc.vim-USAGE-bug@3681 asciidoc.vim-USAGE-bug@2188 asciidoc.vim-USAGE-bug@2183 asciidoc.vim-USAGE-bug Task-FreecellSolver-Testing@3681 Task-FreecellSolver-Testing Task-FreecellSolver-Testing-MultiConfig-0.0.1 Task-FreecellSolver-Testing-0.0.11 Task-FreecellSolver-Testing-0.0.10 Task-FreecellSolver-Testing-0.0.9 Task-FreecellSolver-Testing-0.0.8 Task-FreecellSolver-Testing-0.0.7 Task-FreecellSolver-Testing-0.0.6 Task-FreecellSolver-Testing-0.0.5 Task-FreecellSolver-Testing-0.0.4 Task-FreecellSolver-Testing-0.0.3 MALLOC_CHECK_-problems@3681 MALLOC_CHECK_-problems@1946 MALLOC_CHECK_-problems LATEST_DEVEL@3681 LATEST_DEVEL@573 LATEST_DEVEL Initial_CVS@3681 Initial_CVS@41 Initial_CVS@3 Initial_CVS Games-Solitaire-Verify@3681 Games-Solitaire-Verify Games-Solitaire-Verify-0.1800 Games-Solitaire-Verify-0.1701
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (80 sloc) 2.85 KB
/*
* This file is part of Freecell Solver. It is subject to the license terms in
* the COPYING.txt file found in the top-level directory of this distribution
* and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of
* Freecell Solver, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the COPYING file.
*
* Copyright (c) 2000 Shlomi Fish
*/
// range_solvers_gen_ms_boards.h - a header file that defines some
// static (and preferably inline) routines for generating the Microsoft
// boards.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "gen_ms_boards__rand.h"
typedef size_t CARD;
#define SUIT(card) ((card) & (4 - 1))
#define VALUE(card) ((card) >> 2)
static const char *card_to_string_values = "A23456789TJQK";
static const char *card_to_string_suits = "CDHS";
static inline void card_to_string(char *const s, const CARD card)
{
s[0] = card_to_string_values[VALUE(card)];
s[1] = card_to_string_suits[SUIT(card)];
}
#include "board_gen_lookup1.h"
#ifdef FCS_GEN_BOARDS_WITH_EXTERNAL_API
/* This is to settle gcc's -Wmissing-prototypes which complains about
* missing prototypes for "extern" subroutines.
*
* It is not critical that it would be in the same place because the only
* thing that uses this function is Python's ctypes (in the test files under
* t/t/ ) which does not process the included C code. In the future, we may
* have an external API in which case we'll devise a header for this
* routine.
*
* */
void DLLEXPORT fc_solve_get_board_l(const long long deal_idx, char *const ret);
extern void DLLEXPORT fc_solve_get_board_l(
const long long deal_idx, char *const ret)
#else
static inline void get_board_l(const long long deal_idx, char *const ret)
#endif
{
long long seedx = microsoft_rand__calc_init_seedx(deal_idx);
strcpy(ret, "XX XX XX XX XX XX XX\n"
"XX XX XX XX XX XX XX\n"
"XX XX XX XX XX XX XX\n"
"XX XX XX XX XX XX XX\n"
"XX XX XX XX XX XX\n"
"XX XX XX XX XX XX\n"
"XX XX XX XX XX XX\n"
"XX XX XX XX XX XX\n");
CARD deck[52]; /* deck of 52 unique cards */
/* shuffle cards */
for (size_t i = 0; i < 52; ++i) /* put unique card in each deck loc. */
{
deck[i] = i;
}
microsoft_rand_uint num_cards_left = 52;
for (size_t i = 0; i < 52; ++i)
{
const microsoft_rand_uint j =
microsoft_rand__game_num_rand(&seedx, deal_idx) % num_cards_left;
card_to_string(&ret[offset_by_i[i]], deck[j]);
deck[j] = deck[--num_cards_left];
}
}
#ifndef FCS_GEN_BOARDS_WITH_EXTERNAL_API
static inline void get_board(long deal_idx, char *ret)
{
get_board_l((long long)deal_idx, ret);
}
#endif
typedef char fcs_state_string[52 * 3 + 8 + 1];
#ifdef __cplusplus
}
#endif