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.2202
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 Shlomi Fish <shlomif@cpan.org>
115
117 This software is Copyright (c) 2014 by Shlomi Fish.
118
119 This is free software, licensed under:
120
121 The MIT (X11) License
122
124 Please report any bugs or feature requests on the bugtracker website
125 <https://github.com/shlomif/fc-solve/issues>
126
127 When submitting a bug or request, please include a test-file or a patch
128 to an existing test-file that illustrates the bug or desired feature.
129
131 Perldoc
132 You can find documentation for this module with the perldoc command.
133
134 perldoc Games::Solitaire::Verify::State
135
136 Websites
137 The following websites have more information about this module, and may
138 be of help to you. As always, in addition to those websites please use
139 your favorite search engine to discover more resources.
140
141 · MetaCPAN
142
143 A modern, open-source CPAN search engine, useful to view POD in
144 HTML format.
145
146 <https://metacpan.org/release/Games-Solitaire-Verify>
147
148 · Search CPAN
149
150 The default CPAN search engine, useful to view POD in HTML format.
151
152 <http://search.cpan.org/dist/Games-Solitaire-Verify>
153
154 · RT: CPAN's Bug Tracker
155
156 The RT ( Request Tracker ) website is the default bug/issue
157 tracking system for CPAN.
158
159 <https://rt.cpan.org/Public/Dist/Display.html?Name=Games-Solitaire-Verify>
160
161 · AnnoCPAN
162
163 The AnnoCPAN is a website that allows community annotations of Perl
164 module documentation.
165
166 <http://annocpan.org/dist/Games-Solitaire-Verify>
167
168 · CPAN Ratings
169
170 The CPAN Ratings is a website that allows community ratings and
171 reviews of Perl modules.
172
173 <http://cpanratings.perl.org/d/Games-Solitaire-Verify>
174
175 · CPANTS
176
177 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
178 of a distribution.
179
180 <http://cpants.cpanauthors.org/dist/Games-Solitaire-Verify>
181
182 · CPAN Testers
183
184 The CPAN Testers is a network of smoke testers who run automated
185 tests on uploaded CPAN distributions.
186
187 <http://www.cpantesters.org/distro/G/Games-Solitaire-Verify>
188
189 · CPAN Testers Matrix
190
191 The CPAN Testers Matrix is a website that provides a visual
192 overview of the test results for a distribution on various
193 Perls/platforms.
194
195 <http://matrix.cpantesters.org/?dist=Games-Solitaire-Verify>
196
197 · CPAN Testers Dependencies
198
199 The CPAN Testers Dependencies is a website that shows a chart of
200 the test results of all dependencies for a distribution.
201
202 <http://deps.cpantesters.org/?module=Games::Solitaire::Verify>
203
204 Bugs / Feature Requests
205 Please report any bugs or feature requests by email to
206 "bug-games-solitaire-verify at rt.cpan.org", or through the web
207 interface at
208 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Games-Solitaire-Verify>.
209 You will be automatically notified of any progress on the request by
210 the system.
211
212 Source Code
213 The code is open to the world, and available for you to hack on. Please
214 feel free to browse it and play with it, or whatever. If you want to
215 contribute patches, please send me a diff or prod me to pull from your
216 repository :)
217
218 <https://github.com/shlomif/fc-solve>
219
220 git clone git://github.com/shlomif/fc-solve.git
221
222
223
224perl v5.30.1 2020-01-30Games::Solitaire::Verify::State(3)