Class: PFM::MiningGame::GridHandler
- Defined in:
- docs/4_Systems_801_Mining_Game.rb
Overview
Class handling the grid for the mining game
Constant Summary collapse
- MIN_ITEM_COUNT =
Constant telling the minimum amount of item possible on a grid
2
- MAX_ITEM_COUNT =
Constant telling the maximum amount of item possible on a grid
5
- SWITCH_METHOD_TRIES =
Constant telling at how many unsuccessful tries the system switched from full randomness to semi-randomness A lower number means the system will switch to a more mechanical way earlier Might yield unexpected result, !!! Change with caution !!!
25
- MAX_TRIES_ALLOWED =
Constant telling the max number of tries the system has to randomly place an item or an iron A higher number means a better probability of success but also means a higher loading time !!! Change with caution !!!
50
Instance Attribute Summary collapse
-
#arr_irons ⇒ Array<Diggable>
readonly
Get the list of irons.
-
#arr_items ⇒ Array<Diggable>
readonly
Get the list of diggable items.
-
#arr_tiles_state ⇒ Array<Array<Integer>>
readonly
Get the tile states.
-
#height ⇒ Integer
readonly
Get the grid height.
-
#width ⇒ Integer
readonly
Get the grid width.
Instance Method Summary collapse
-
#check_presence_of_diggable(x, y) ⇒ Diggable, Boolean
Check if a diggable is present at the said coordinate and return it if it’s an item.
-
#initialize(wanted_items, item_count, grid_width, grid_height) ⇒ GridHandler
constructor
Create a new grid handler.
-
#ready? ⇒ Boolean
Tell if the mining game grid is ready.
Constructor Details
#initialize(wanted_items, item_count, grid_width, grid_height) ⇒ GridHandler
Create a new grid handler
177 178 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 177 def initialize(wanted_items, item_count, grid_width, grid_height) end |
Instance Attribute Details
#arr_irons ⇒ Array<Diggable> (readonly)
Get the list of irons
171 172 173 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 171 def arr_irons @arr_irons end |
#arr_items ⇒ Array<Diggable> (readonly)
Get the list of diggable items
168 169 170 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 168 def arr_items @arr_items end |
#arr_tiles_state ⇒ Array<Array<Integer>> (readonly)
Get the tile states
165 166 167 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 165 def arr_tiles_state @arr_tiles_state end |
#height ⇒ Integer (readonly)
Get the grid height
162 163 164 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 162 def height @height end |
#width ⇒ Integer (readonly)
Get the grid width
159 160 161 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 159 def width @width end |
Instance Method Details
#check_presence_of_diggable(x, y) ⇒ Diggable, Boolean
Check if a diggable is present at the said coordinate and return it if it’s an item
187 188 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 187 def check_presence_of_diggable(x, y) end |
#ready? ⇒ Boolean
Tell if the mining game grid is ready
181 182 |
# File 'docs/4_Systems_801_Mining_Game.rb', line 181 def ready? end |