Class: GamesAndRpgParadise::Solitaire::Player

Inherits:
Base
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/solitaire/player.rb

Overview

GamesAndRpgParadise::Solitaire::Player

Constant Summary

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ Player

#

initialize

#


25
26
27
28
29
30
31
32
33
34
# File 'lib/games_and_rpg_paradise/games/solitaire/player.rb', line 25

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

GamesAndRpgParadise::Solitaire::Player[]

#


61
62
63
# File 'lib/games_and_rpg_paradise/games/solitaire/player.rb', line 61

def self.[](i = ARGV)
  new(i)
end

Instance Method Details

#resetObject

#

reset (reset tag)

#


39
40
41
42
43
# File 'lib/games_and_rpg_paradise/games/solitaire/player.rb', line 39

def reset
  super()
  infer_the_namespace
  @playing_cards = []
end

#runObject

#

run (run tag)

#


48
49
50
51
52
53
54
55
56
# File 'lib/games_and_rpg_paradise/games/solitaire/player.rb', line 48

def run
  Solitaire.new
  _ = GamesAndRpgParadise::Solitaire::Solitaire.solitaire?
  # ======================================================================= #
  # Each player gets two cards.
  # ======================================================================= #
  @playing_cards << _.draw_a_random_card
  @playing_cards << _.draw_a_random_card
end