# - Set the logfile: # - Log.set_logger_file("yourlogfile.log") # - Log a header: # - Log.log(Log.Severity.Header, "Your Header") # - Log a line: # - Log.log_line() # - Log a normal message: # - Log.log(Log.Severity.Normal, "Your Message") # - Etc... import time import Common import os ## Denotes the severity of the message Severity = Common.enum(Header=0, Normal=1, OK=2, Warning=3, Fail=4) _logger_output_file=None _logfile_name='log.log' ## Opens a file for logging output. # @warning This overwrites the current # @param name the name of the output file. No formatting done def set_logger_file(name = "log.log"): global _logger_output_file global _logfile_name _logfile_name=name _logger_output_file = open(_logfile_name,'w') _colors = ["\033[95m","\033[94m","\033[92m","\033[93m","\033[91m","\033[0m"]
## @package Card # Definition of a card for the Cards simulation # # @author Kevin Wierman import Common ## Defines the numerical values for card suits. # The Ranking is as follows: # 0. Non-suit type for null-cards (value=Suits.no_suit) # 1. Hearts (value=Suits.hearts) # 2. Spades (value=Suits.spades) # 3. Diamonds (value=Suits.diamonds) # 4. Clubs (value=Suits.clubs) Suits = Common.enum(no_suit=0,hearts=1,spades=2,diamonds=3,clubs=4) Ranks = Common.enum(joker=0,ace=1,jack=11,queen=12,king=13) ## Private implementation of the suit used in the card in order to avoid unneccessary comparison # class _Suit: ## Default behavior is to def __init__(self, value=Suits.no_suit): self.value = value def __eq__(self, other): return self.value == other.value ## String representation is in the format: "<value>" def __str__(self): if(self.value == Suits.hearts): return "hearts" elif(self.value == Suits.spades): return "spades"