FreeCell Puzzle Protocol Document

Similar documents
This watermark does not appear in the registered version - Sokoban Protocol Document

Sliding Box Puzzle Protocol Document

10 Game. Chapter. The PV Unit comes with two built-in games for your enjoyment. The games are named Game-1 and Game-2.

Chapter 2 Integers. Math 20 Activity Packet Page 1

CS Programming Project 1

CS Project 1 Fall 2017

Corners! How To Play - a Comprehensive Guide. Written by Peter V. Costescu RPClasses.com

PLAYERS AGES MINS.

Dungeon Crawler Card Game

THE NUMBER WAR GAMES

5.8 Problems (last update 30 May 2018)

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

CSCI 4150 Introduction to Artificial Intelligence, Fall 2004 Assignment 7 (135 points), out Monday November 22, due Thursday December 9

An Amazing Mathematical Card Trick

Maryland State Lottery and Gaming Control Agency Standard Rules Criss Cross Poker

Activity 1: Play comparison games involving fractions, decimals and/or integers.

Venn Diagram Problems

Maryland State Lottery and Gaming Control Agency Standard Rules - Double Draw Poker

Such a description is the basis for a probability model. Here is the basic vocabulary we use.

Poker Hands. Christopher Hayes

{ a, b }, { a, c }, { b, c }

No Flop No Table Limit. Number of

Roll & Make. Represent It a Different Way. Show Your Number as a Number Bond. Show Your Number on a Number Line. Show Your Number as a Strip Diagram

PROBLEM SET 2 Due: Friday, September 28. Reading: CLRS Chapter 5 & Appendix C; CLR Sections 6.1, 6.2, 6.3, & 6.6;

CHAPTER 649a. THREE CARD POKER

Lab 1. CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007

FAST ACTION HOLD EM. Copy hand-- means a five-card hand of a player that is identical in rank to the five-card hand of the dealer.

Conditional Probability Worksheet

CS 152 Computer Programming Fundamentals Lab 8: Klondike Solitaire

Activity 6: Playing Elevens

Discrete Finite Probability Probability 1

TEXAS HOLD EM BONUS POKER

To play the game player has to place a bet on the ANTE bet (initial bet). Optionally player can also place a BONUS bet.

LATE 19 th CENTURY WARGAMES RULES Based on and developed by Bob Cordery from an original set of wargames rules written by Joseph Morschauser

LATE 19 th CENTURY WARGAMES RULES Based on and developed by Bob Cordery from an original set of wargames rules written by Joseph Morschauser

HEADS UP HOLD EM. "Cover card" - means a yellow or green plastic card used during the cut process and then to conceal the bottom card of the deck.

BRIDGE is a card game for four players, who sit down at a

TABLE GAMES RULES OF THE GAME

Conditional Probability Worksheet

Grades 7 & 8, Math Circles 27/28 February, 1 March, Mathematical Magic

3 The multiplication rule/miscellaneous counting problems

FLOP POKER. Rank-- or ranking means the relative position of a card or hand as set forth in Section 5.

13:69E 1.13Z 5 Card Hi Lo table; physical characteristics. (a) 5 card hi lo shall be played at a table having on one side

A. Rules of blackjack, representations, and playing blackjack

(a) Suppose you flip a coin and roll a die. Are the events obtain a head and roll a 5 dependent or independent events?

BALTIMORE COUNTY PUBLIC SCHOOLS. Rock n Roll

Developed by Rashmi Kathuria. She can be reached at

CRISS-CROSS POKER. Community cards Cards which are used by all players to form a five-card Poker hand.

Project 2 - Blackjack Due 7/1/12 by Midnight

3 The multiplication rule/miscellaneous counting problems

CSE 231 Fall 2012 Programming Project 8

Poker Rules Friday Night Poker Club

Counting Poker Hands

Battle. Table of Contents. James W. Gray Introduction

Mathematical Magic for Muggles April 16, 2013

13:69E-1.13Z Criss cross poker; physical characteristics

LEARN HOW TO PLAY MINI-BRIDGE

Pan (7:30am) Juan (8:30am) Juan (9:30am) Allison (10:30am) Allison (11:30am) Mike L. (12:30pm) Mike C. (1:30pm) Grant (2:30pm)

If you roll a die, what is the probability you get a four OR a five? What is the General Education Statistics

OCTAGON 5 IN 1 GAME SET

For this assignment, your job is to create a program that plays (a simplified version of) blackjack. Name your program blackjack.py.

Ante or ante wager means the initial wager required to be made prior to any cards being dealt in order to participate in the round of play.

The Secret to Performing the Jesse James Card Trick

The Human Calculator: (Whole class activity)

Bridge Players: 4 Type: Trick-Taking Card rank: A K Q J Suit rank: NT (No Trumps) > (Spades) > (Hearts) > (Diamonds) > (Clubs)

FOUR CARD POKER. Hand-- means the best four card poker hand that can be formed by each player and the dealer from the cards they are dealt.

3. If you can t make the sum with your cards, you must draw one card. 4. Players take turns rolling and discarding cards.

CHAPTER 592. CRISS-CROSS POKER

1. Definitions 2. Mode of Play 3. How to Play 4. Settlement 5. Irregularities

FORTUNE PAI GOW POKER

Battle over Britain Tactical Air Combat Game, RAF vs Luftwaffe, 1940

Live Casino game rules. 1. Live Baccarat. 2. Live Blackjack. 3. Casino Hold'em. 4. Generic Rulette. 5. Three card Poker

Teaching the TERNARY BASE

Poker: Probabilities of the Various Hands

LESSON 3. Developing Tricks the Finesse. General Concepts. General Information. Group Activities. Sample Deals

Item Description - MC Phi - Please note: any activity that is not completed during class time may be set for homework or undertaken at a later date.

The point value of each problem is in the left-hand margin. You must show your work to receive any credit, except on problems 1 & 2. Work neatly.

ULTIMATE TEXAS HOLD EM

POKER. Bet-- means an action by which a player places gaming chips or gaming plaques into the pot on any betting round.

COMP 9 Lab 3: Blackjack revisited

CHAPTER 69F RULES OF THE GAMES

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

Up & Down GOAL OF THE GAME UP&DOWN CARD A GAME BY JENS MERKL & JEAN-CLAUDE PELLIN ART BY CAMILLE CHAUSSY

Poker: Further Issues in Probability. Poker I 1/29

YourTurnMyturn.com: rules Rummy. Bram Schoonhoven Copyright 2018 YourTurnMyturn.com

LESSON 5. Watching Out for Entries. General Concepts. General Introduction. Group Activities. Sample Deals

2. A separate designated betting area at each betting position for the placement of the ante wager;

CATFISH BEND CASINOS, L.C. RULES OF THE GAME FOUR CARD POKER

10, J, Q, K, A all of the same suit. Any five card sequence in the same suit. (Ex: 5, 6, 7, 8, 9.) All four cards of the same index. (Ex: A, A, A, A.

CHAPTER 641a. FOUR CARD POKER

Maths games and activities to help your child s learning Enjoy!

After receiving his initial two cards, the player has four standard options: he can "Hit," "Stand," "Double Down," or "Split a pair.

Tribute to Martin Gardner: Combinatorial Card Problems

Problem A. Worst Locations

HIGH CARD FLUSH 1. Definitions

Convert the Egyptian numeral to Hindu-Arabic form. 1) A) 3067 B) 3670 C) 3607 D) 367

To Your Hearts Content

LET IT RIDE POKER. Stub-- means the remaining portion of the deck after all cards in the round of play have been dealt or delivered.

MATH-1110 FINAL EXAM FALL 2010

6/24/14. The Poker Manipulation. The Counting Principle. MAFS.912.S-IC.1: Understand and evaluate random processes underlying statistical experiments

Transcription:

AI Puzzle Framework FreeCell Puzzle Protocol Document Brian Shaver April 11, 2005

FreeCell Puzzle Protocol Document Page 2 of 7 Table of Contents Table of Contents...2 Introduction...3 Puzzle Description... 3 Rules... 3 Board State...4 Flags... 4 Representation... 4 Sample Board Layout File...4 Module Requirements...5 Puzzle Number... 5 Puzzle Module... 6 Board Module... 6 Player Module... 6

FreeCell Puzzle Protocol Document Page 3 of 7 Introduction Puzzle Description FreeCell is a card game which utilizes 1 (one) standard 52 card deck of cards. These cards are all dealt face-up into 8 tableau piles, and by moving cards between stacks, and using the 4 (four) free cell locations, the goal is to have all cards placed on the 4 (four) foundation piles ordered by value, and separated by suit. Rules 1. A card is a piece with a value and a suit. 2. A suit is one of 4 (four) sub-categories that cards can be divided into. The four suits are Spades (, black), Hearts (, red), Clubs (, black), and Diamonds (, red). 3. The value of a card is between 1 and 13, inclusive. A 1 is represented as an Ace (or simply A ), values 2 through 10, inclusive, are represented as their numeric values (2-10), and values 11, 12, and 13 are represented as Jack ( J ), Queen ( Q ), and King ( K ) respectively. 4. A tableau pile is a stack of cards that may contain between 0 (zero) and 19 cards, inclusive. 5. A free cell is a location which can contain at between 0 (zero) and 1 (one) cards, inclusive, of any value or suit. 6. A foundation pile is a stack of cards that may contain between 0 (zero) and 13 cards, inclusive. All cards in a given foundation pile must be of the same suit, and must be stacked in the following order (from bottom to top): A-1-2-3-4-5-6-7-8-9-10-J-Q-K. 7. The board for FreeCell consists of 4 (four) free cell locations, 4 (four) foundation piles, and 8 (eight) tableau piles. 8. Initially, cards are randomly shuffled and dealt face-up onto the tableau piles, from left to right, until all 52 cards have been dealt. The number of cards in each pile, from left to right must be 7, 7, 7, 7, 6, 6, 6, 6. The free cells and foundation piles must initially be empty. 9. A move consists of the relocation of the top 1 (one) card from either a tableau pile or a free cell to a valid location on a free cell, tableau pile, or foundation pile. 10. A card can only be moved to a tableau pile if the pile is empty (contains no cards), or if the top card on the pile is of the opposite color (either red or black) and the immediately following value as the card which is being moved to the pile. For example, a red 4 can only be moved to an empty pile or a pile with a black 5 on top. 11. A card can only be moved to a foundation pile if the card of the same suit with the immediately preceding value has already been placed on the given foundation pile. For example, a 4 of diamonds can only be moved to a foundation pile which has a 3 of diamonds on top. An Ace can only be moved to a foundation pile which is empty. 12. A card can only be moved to a free cell which is empty. Any card can be placed on a free cell. 13. A card cannot be moved from a foundation pile at any time.

FreeCell Puzzle Protocol Document Page 4 of 7 14. A solution to the puzzle is defined as a series of moves which ends with all the cards located on the foundation piles. 15. Every puzzle which has a solution will have an optimal solution, such that the total number of moves for the solution is the lowest of all the total moves for any possible solution in the given puzzle. 16. The overall goal for the player is to find an optimal solution to the puzzle. 17. It is possible to lose the puzzle if there are no moves remaining and all 52 cards are not located on the foundation piles. Board State Flags The following flags are used by the FreeCell Puzzle when configuring the board state: Flag USE_TIME USE_MOVES LIMIT_NONE Representation Count time for the puzzle Purpose Count moves for the puzzle Do not limit the puzzle based on time or moves See Appendix A for a quick conversion table. The FreeCell Puzzle board state is represented internally and in.puz layout files as follows (which corresponding ASCII values in base 10): Character ASCII Value Meaning Space 32 Unoccupied space [A,M] [65,77] Ace through King of Spades, respectively [N,Z] [78,90] Ace through King of Clubs, respectively [a,m] [97,109] Ace through King of Hearts, respectively [n,z] [110,122] Ace through King of Diamonds, respectively Representation Tips The first row of the board layout is used to represent the 4 (four) free cells followed by the 4 (four) foundation piles. Each column of the board layout represents 1 (one) tableau pile (with the exception of the first row, as previously noted). Thus, location (0,1) represents the lowest position on the first tableau pile on the left, (3,5) represents the fifth card (counting from the bottom) on the fourth tableau pile, (2,0) represents the third free cell (counting from the left), and (5,0) represents the second foundation pile. The value placed on the foundation pile space represents the value of the top card on that pile. It can be assumed that all cards of the same suit with a value less than that of the top card are located, in order, below the top card.

FreeCell Puzzle Protocol Document Page 5 of 7 More specific information about different cards based off their ASCII text value can be found using several quick mathematical operations: 1. The color of the card can be found easily, because black cards have a value between 65 and 90, inclusive, while red cards have a value between 97 and 122, inclusive. 2. The value of the card (independent of its suit) can be found by taking the value of the card, subtracting 6 if it is a red card or 0 if it is black, doing modulus division by 13 on the resulting value, and finally adding 1. This will give the numeric value of the card. value = ((A<97?A:(A-6))%13)+1; Sample Board Layout File Following the standards for board layout files (.puz files) defined in the Module Developer Guide, the following is a sample board layout file for the FreeCell Puzzle: 5 20 8 0 0 0 0 0 0 FbRZPvIr ekyoutfx dnygxuwm NKiAEqJz BVMLWSoc phcjhtlg DQas Module Requirements Puzzle Number The FreeCell Puzzle has a puzzle identification number (puzid) of 5 (five), which must be set in the LibraryInfo for each of the modules, and for the board layout files intended for use with the FreeCell Puzzle. Use of any other number will cause the given module or layout

FreeCell Puzzle Protocol Document Page 6 of 7 file to not work correctly with the given puzzle, and may also conflict with other, previously defined puzzle ID numbers. Puzzle Module For the FreeCell Puzzle, the puzzle module will contain an initial state, and it will not be loaded from a.puz board layout file initially. The puzzle module should generate and return a new random state when the getinitialstate function is called. For this reason, the hasinitialstate function should always return true. Also, the checkboardstate function is still required, because the user can still save and load board layouts from a file. The board state is fully visible to the player at all times, so the full board state should always be returned by the module. Board Module The board module must be sure to display the cards in the tableau piles in such a way that the user can see the value and suit of all the cards in the pile. For foundation piles, only the top card must be visible. The board module does not have to be able to handle keyboard movements from the user, because the user can move any card at any time. Mouse movements should be handled when the user clicks on the pile or free cell which has a card to move and the pile to move the top card to. Player Module No special requirements are necessary for the player module in the FreeCell Puzzle. It is important to note, however, that not all moves can be backtracked to the previous state; thus, the puzzle can be lost if there are no valid moves left to be made.

FreeCell Puzzle Protocol Document Page 7 of 7 Appendix A Conversion Table Character Conversion Spades ( ) Clubs ( ) Hearts ( ) Diamonds ( ) 1 Ace A N a n 2 B O b o 3 C P c p 4 D Q d q 5 E R e r 6 F S f s 7 G T g t 8 H U h u 9 I V i v 10 J W j w 11 Jack K X k x 12 Queen L Y l y 13 King M Z m z ASCII Val. Conversion Spades ( ) Clubs ( ) Hearts ( ) Diamonds ( ) 1 Ace 65 78 97 110 2 66 79 98 111 3 67 80 99 112 4 68 81 100 113 5 69 82 101 114 6 70 83 102 115 7 71 84 103 116 8 72 85 104 117 9 73 86 105 118 10 74 87 106 119 11 Jack 75 88 107 120 12 Queen 76 89 108 121 13 King 77 90 109 122