2009-04-07 18:34:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								USING:  help.markup  help.syntax  strings  ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								IN:  poker 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  <hand> 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 18:50:46 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "str"  string  } { "hand"  "a new "  { $link hand } } }
							 
						 
					
						
							
								
									
										
										
										
											2009-04-07 18:34:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Creates a new poker hand containing the cards specified in "  { $snippet "str"  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example "USING: kernel math.order poker prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"AC KC QC JC TC\" \"7C 6D 5H 4S 2C\" [ <hand> ] bi@ <=> ."  "+lt+"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example "USING: kernel poker prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"TC 9C 8C 7C 6C\" \"TH 9H 8H 7H 6H\" [ <hand> ] bi@ = ."  "t"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $notes "Cards may be specified in any order. Hands are directly comparable to each other on the basis of their computed value. Two hands are considered equal when they would tie in a game (despite being composed of different cards)."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 16:54:49 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HELP:  best-hand 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 18:50:46 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "str"  string  } { "hand"  "a new "  { $link hand } } }
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 16:54:49 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $description "Creates a new poker hand containing the best possible combination of the cards specified in "  { $snippet "str"  } "."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example "USING: kernel poker prettyprint ;" 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 23:11:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "\"AS KD JC KH 2D 2S KC\" best-hand >value ."  "\"Full House\""  }
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 16:54:49 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-04-07 18:34:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  >cards 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 18:50:46 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "hand"  hand } { "str"  string  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-04-07 18:34:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs a string representation of a hand's cards."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example "USING: poker prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"AC KC QC JC TC\" <hand> >cards ."  "\"AC KC QC JC TC\""  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  >value 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 18:50:46 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "hand"  hand } { "str"  string  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-04-07 18:34:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs a string representation of a hand's value."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { $example "USING: poker prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "\"AC KC QC JC TC\" <hand> >value ."  "\"Straight Flush\""  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $notes "This should not be used as a basis for hand comparison."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-07 18:50:46 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  <deck> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "deck"  "a new "  { $link deck } } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Creates a standard deck of 52 cards."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  shuffle 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "deck"  deck } { "deck"  "a shuffled "  { $link deck } } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Shuffles the cards in "  { $snippet "deck"  } ", in-place, using the Fisher-Yates algorithm."  } ;