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.1900
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 version 0.1900
44
46 $self->set_freecells($freecells)
47 Sets the freecells' object, which should be a
48 Games::Solitaire::Verify::Freecells object.
49
50 $self->add_column($columns)
51 Adds a new column of cards that should be an
52 Games::Solitaire::Verify::Column object.
53
54 $self->set_foundations($foundations);
55 Sets the foundations to a value. Should be isa
56 Games::Solitaire::Verify::Foundations .
57
58 $state->get_freecell($index)
59 Returns the contents of the freecell No. $index or undef() if it's
60 empty.
61
62 $state->set_freecell($index, $card)
63 Assigns $card to the contents of the freecell No. $index .
64
65 $state->get_foundation_value($suit, $index)
66 Returns the foundation value for the suit $suit of the foundations No.
67 $index .
68
69 $state->increment_foundation_value($suit, $index)
70 Increments the foundation value for the suit $suit of the foundations
71 No. $index .
72
73 $board->num_decks()
74 Returns the number of decks that the variant has. Useful when querying
75 the foundations.
76
77 $board->num_freecells()
78 Returns the number of Freecells in the board.
79
80 $board->num_empty_freecells()
81 Returns the number of empty Freecells on the board.
82
83 $board->num_columns()
84 The number of columns in the board.
85
86 $board->get_column($index)
87 Gets the column object for column No. $index.
88
89 $board->num_empty_columns()
90 Returns the number of completely unoccupied columns in the board.
91
92 $board->clone()
93 Returns a clone of the board, with all of its element duplicated.
94
95 my $verdict = $board->verify_and_perform_move($move);
96 Performs $move on the board. If successful, returns 0. Else returns a
97 non-zero value. See Games::Solitaire::Verify::Move for more
98 information.
99
100 $self->clear_freecell($index)
101 Clears/empties the freecell at position $pos .
102
103 $board->verify_contents({max_rank => 13});
104 Verify that all the cards inside the state are present and exactly
105 once. 'max_rank' should be 13 unless you want to only include cards up
106 to a lower rank.
107
108 This method either throws an exception object or returns normally.
109
110 (New in version 0.1900 .)
111
112 $self->to_string()
113 Stringifies the board into the Freecell Solver solution display
114 notation.
115
117 Shlomi Fish <shlomif@cpan.org>
118
120 This software is Copyright (c) 2014 by Shlomi Fish.
121
122 This is free software, licensed under:
123
124 The MIT (X11) License
125
127 Please report any bugs or feature requests on the bugtracker website
128 <https://github.com/shlomif/fc-solve/issues>
129
130 When submitting a bug or request, please include a test-file or a patch
131 to an existing test-file that illustrates the bug or desired feature.
132
134 Perldoc
135 You can find documentation for this module with the perldoc command.
136
137 perldoc Games::Solitaire::Verify::State
138
139 Websites
140 The following websites have more information about this module, and may
141 be of help to you. As always, in addition to those websites please use
142 your favorite search engine to discover more resources.
143
144 · MetaCPAN
145
146 A modern, open-source CPAN search engine, useful to view POD in
147 HTML format.
148
149 <https://metacpan.org/release/Games-Solitaire-Verify>
150
151 · Search CPAN
152
153 The default CPAN search engine, useful to view POD in HTML format.
154
155 <http://search.cpan.org/dist/Games-Solitaire-Verify>
156
157 · RT: CPAN's Bug Tracker
158
159 The RT ( Request Tracker ) website is the default bug/issue
160 tracking system for CPAN.
161
162 <https://rt.cpan.org/Public/Dist/Display.html?Name=Games-Solitaire-Verify>
163
164 · AnnoCPAN
165
166 The AnnoCPAN is a website that allows community annotations of Perl
167 module documentation.
168
169 <http://annocpan.org/dist/Games-Solitaire-Verify>
170
171 · CPAN Ratings
172
173 The CPAN Ratings is a website that allows community ratings and
174 reviews of Perl modules.
175
176 <http://cpanratings.perl.org/d/Games-Solitaire-Verify>
177
178 · CPANTS
179
180 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
181 of a distribution.
182
183 <http://cpants.cpanauthors.org/dist/Games-Solitaire-Verify>
184
185 · CPAN Testers
186
187 The CPAN Testers is a network of smoke testers who run automated
188 tests on uploaded CPAN distributions.
189
190 <http://www.cpantesters.org/distro/G/Games-Solitaire-Verify>
191
192 · CPAN Testers Matrix
193
194 The CPAN Testers Matrix is a website that provides a visual
195 overview of the test results for a distribution on various
196 Perls/platforms.
197
198 <http://matrix.cpantesters.org/?dist=Games-Solitaire-Verify>
199
200 · CPAN Testers Dependencies
201
202 The CPAN Testers Dependencies is a website that shows a chart of
203 the test results of all dependencies for a distribution.
204
205 <http://deps.cpantesters.org/?module=Games::Solitaire::Verify>
206
207 Bugs / Feature Requests
208 Please report any bugs or feature requests by email to
209 "bug-games-solitaire-verify at rt.cpan.org", or through the web
210 interface at
211 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Games-Solitaire-Verify>.
212 You will be automatically notified of any progress on the request by
213 the system.
214
215 Source Code
216 The code is open to the world, and available for you to hack on. Please
217 feel free to browse it and play with it, or whatever. If you want to
218 contribute patches, please send me a diff or prod me to pull from your
219 repository :)
220
221 <https://github.com/shlomif/fc-solve>
222
223 git clone git://github.com/shlomif/fc-solve.git
224
225
226
227perl v5.28.1 2019-02-02Games::Solitaire::Verify::State(3)