1Games::Solitaire::VerifUys:e:rStCaotnet(r3i)buted Perl DGoacmuemse:n:tSaotliiotnaire::Verify::State(3)
2
3
4
6 Games::Solitaire::Verify::State - a class for Solitaire states (or
7 positions) of the entire board.
8
10 version 0.2403
11
13 use Games::Solitaire::Verify::State;
14
15 my $board = <<"EOF";
16 Foundations: H-6 C-A D-A S-4
17 Freecells: 3D 8H JH 9H
18 : 4C 2C 9C 8C QS JD
19 : KS QH
20 : QC 9S
21 : 5C
22 : 2D KD TH TC TD 8D 7C 6D 5S 4D 3C
23 : 7H JS KH TS KC QD JC
24 : 9D 8S
25 : 7S 6C 7D 6S 5D
26 EOF
27
28 # Initialise a board
29 my $board = Games::Solitaire::Verify::State->new(
30 {
31 string => $board,
32 variant => "freecell",
33 },
34 );
35
36 # Prints 8.
37 print $board->num_columns(), "\n";
38
39 # Prints ": QC 9S"
40 print $board->get_column(2)->to_string(), "\n"
41
43 $self->set_freecells($freecells)
44 Sets the freecells' object, which should be a
45 Games::Solitaire::Verify::Freecells object.
46
47 $self->add_column($columns)
48 Adds a new column of cards that should be an
49 Games::Solitaire::Verify::Column object.
50
51 $self->set_foundations($foundations);
52 Sets the foundations to a value. Should be isa
53 Games::Solitaire::Verify::Foundations .
54
55 $state->get_freecell($index)
56 Returns the contents of the freecell No. $index or undef() if it's
57 empty.
58
59 $state->set_freecell($index, $card)
60 Assigns $card to the contents of the freecell No. $index .
61
62 $state->get_foundation_value($suit, $index)
63 Returns the foundation value for the suit $suit of the foundations No.
64 $index .
65
66 $state->increment_foundation_value($suit, $index)
67 Increments the foundation value for the suit $suit of the foundations
68 No. $index .
69
70 $board->num_decks()
71 Returns the number of decks that the variant has. Useful when querying
72 the foundations.
73
74 $board->num_freecells()
75 Returns the number of Freecells in the board.
76
77 $board->num_empty_freecells()
78 Returns the number of empty Freecells on the board.
79
80 $board->num_columns()
81 The number of columns in the board.
82
83 $board->get_column($index)
84 Gets the column object for column No. $index.
85
86 $board->num_empty_columns()
87 Returns the number of completely unoccupied columns in the board.
88
89 $board->clone()
90 Returns a clone of the board, with all of its element duplicated.
91
92 my $verdict = $board->verify_and_perform_move($move);
93 Performs $move on the board. If successful, returns 0. Else returns a
94 non-zero value. See Games::Solitaire::Verify::Move for more
95 information.
96
97 $self->clear_freecell($index)
98 Clears/empties the freecell at position $pos .
99
100 $board->verify_contents({max_rank => 13});
101 Verify that all the cards inside the state are present and exactly
102 once. 'max_rank' should be 13 unless you want to only include cards up
103 to a lower rank.
104
105 This method either throws an exception object or returns normally.
106
107 (New in version 0.1900 .)
108
109 $self->to_string()
110 Stringifies the board into the Freecell Solver solution display
111 notation.
112
114 Websites
115 The following websites have more information about this module, and may
116 be of help to you. As always, in addition to those websites please use
117 your favorite search engine to discover more resources.
118
119 • MetaCPAN
120
121 A modern, open-source CPAN search engine, useful to view POD in
122 HTML format.
123
124 <https://metacpan.org/release/Games-Solitaire-Verify>
125
126 • RT: CPAN's Bug Tracker
127
128 The RT ( Request Tracker ) website is the default bug/issue
129 tracking system for CPAN.
130
131 <https://rt.cpan.org/Public/Dist/Display.html?Name=Games-Solitaire-Verify>
132
133 • CPANTS
134
135 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
136 of a distribution.
137
138 <http://cpants.cpanauthors.org/dist/Games-Solitaire-Verify>
139
140 • CPAN Testers
141
142 The CPAN Testers is a network of smoke testers who run automated
143 tests on uploaded CPAN distributions.
144
145 <http://www.cpantesters.org/distro/G/Games-Solitaire-Verify>
146
147 • CPAN Testers Matrix
148
149 The CPAN Testers Matrix is a website that provides a visual
150 overview of the test results for a distribution on various
151 Perls/platforms.
152
153 <http://matrix.cpantesters.org/?dist=Games-Solitaire-Verify>
154
155 • CPAN Testers Dependencies
156
157 The CPAN Testers Dependencies is a website that shows a chart of
158 the test results of all dependencies for a distribution.
159
160 <http://deps.cpantesters.org/?module=Games::Solitaire::Verify>
161
162 Bugs / Feature Requests
163 Please report any bugs or feature requests by email to
164 "bug-games-solitaire-verify at rt.cpan.org", or through the web
165 interface at
166 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Games-Solitaire-Verify>.
167 You will be automatically notified of any progress on the request by
168 the system.
169
170 Source Code
171 The code is open to the world, and available for you to hack on. Please
172 feel free to browse it and play with it, or whatever. If you want to
173 contribute patches, please send me a diff or prod me to pull from your
174 repository :)
175
176 <https://github.com/shlomif/fc-solve>
177
178 git clone git://github.com/shlomif/fc-solve.git
179
181 Shlomi Fish <shlomif@cpan.org>
182
184 Please report any bugs or feature requests on the bugtracker website
185 <https://github.com/shlomif/fc-solve/issues>
186
187 When submitting a bug or request, please include a test-file or a patch
188 to an existing test-file that illustrates the bug or desired feature.
189
191 This software is Copyright (c) 2008 by Shlomi Fish.
192
193 This is free software, licensed under:
194
195 The MIT (X11) License
196
197
198
199perl v5.36.0 2022-07-22Games::Solitaire::Verify::State(3)