Class: GamesParadise::Solitaire::Player

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

Overview

GamesParadise::Solitaire::Player

Constant Summary

Constants inherited from Base

Base::CONTROL_C_CODE, Base::N

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cat, #commandline_arguments?, #efancy, #eparse, #first_argument?, #forestgreen, #gold, #lightblue, #lightgreen, #mediumorchid, #mediumslateblue, #opnn, #peru, #register_sigint, #rev, #royalblue, #set_commandline_arguments, #sfile, #steelblue, #teal, #tomato, #yellow

Methods included from BaseModule

#cliner, #commandline_arguments?, #first_argument?, #infer_the_namespace, #namespace?, #rename_file, #reset_the_internal_hash, #return_pwd, #set_commandline_arguments

Constructor Details

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

#

initialize

#


25
26
27
28
29
30
31
32
33
34
# File 'lib/games_paradise/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 = '') ⇒ Object

#

GamesParadise::Solitaire::Player[]

#


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

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

Instance Method Details

#resetObject

#

reset (reset tag)

#


39
40
41
42
43
# File 'lib/games_paradise/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_paradise/solitaire/player.rb', line 48

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