Class: Ropt::AntagonisticGames::MatrixGame

Inherits:
Object
  • Object
show all
Defined in:
lib/ropt/antagonistic_games/matrix_game.rb

Overview

class for matrix game solver with option of get report string message

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rows) ⇒ MatrixGame

Returns a new instance of MatrixGame.



11
12
13
14
15
# File 'lib/ropt/antagonistic_games/matrix_game.rb', line 11

def initialize(rows)
  @matrix = Ropt::VectorMatrixMath::ShellMatrix.create(rows)
  @count_rows = rows.size
  @count_columns = rows.first.size
end

Instance Attribute Details

#count_columnsObject

Returns the value of attribute count_columns.



9
10
11
# File 'lib/ropt/antagonistic_games/matrix_game.rb', line 9

def count_columns
  @count_columns
end

#count_rowsObject

Returns the value of attribute count_rows.



9
10
11
# File 'lib/ropt/antagonistic_games/matrix_game.rb', line 9

def count_rows
  @count_rows
end

#matrixObject

Returns the value of attribute matrix.



9
10
11
# File 'lib/ropt/antagonistic_games/matrix_game.rb', line 9

def matrix
  @matrix
end

Instance Method Details

#solveObject



17
18
19
# File 'lib/ropt/antagonistic_games/matrix_game.rb', line 17

def solve
  hash_result
end