Module: PlaceBlocks

Included in:
Maze
Defined in:
lib/helper_tools/place_blocks.rb

Instance Method Summary collapse

Instance Method Details

#add_block(row, col, want_print = true, options = {color: :teal}) ⇒ Object



3
4
5
# File 'lib/helper_tools/place_blocks.rb', line 3

def add_block(row,col,want_print=true,options={color: :teal})
  block_placement("",row,col,want_print,options)
end

#add_many_blocks(block_array, want_print = true) ⇒ Object



11
12
13
# File 'lib/helper_tools/place_blocks.rb', line 11

def add_many_blocks(block_array,want_print=true)
  many_blocks_placement("", block_array, want_print)
end

write method to report the custom settinges



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/helper_tools/place_blocks.rb', line 20

def print_settings
  @settings[:starting_player_location] = current_square
  @settings[:blocks] = []
  map.each_with_index do |row, row_i|
    row.each_with_index do |col, col_i|
      if col.include?("")
        @settings[:blocks] << [row_i,col_i]
      end
    end
  end

  puts ""
  puts ""
  puts <<-set_report
           Settings Report
------------------------------------------

      PASTE EVERYTHING BELOW INTO 
         THE SESSIONS OPTIONS
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


{
  set_report
  @settings.each.with_index do |pair, index|
    if pair[0] == :map
      puts "    map: {"
      puts "          rows: #{pair[1][:rows]},"
      puts "          cols: #{pair[1][:cols]}"
      line = "          }"
      line += "," if index != @settings.length - 1
      puts line
    else
      line = "    #{pair[0]}: #{pair[1]}"
      line += "," if index != @settings.length - 1
      puts line
    end
  end
  puts "}"
  puts ""
  puts ""
  puts "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
  true
end

#remove_block(row, col, want_print = true, options = {color: :teal}) ⇒ Object



7
8
9
# File 'lib/helper_tools/place_blocks.rb', line 7

def remove_block(row,col,want_print=true,options={color: :teal})
  block_placement("¤ ",row,col,want_print,options)
end

#remove_many_blocks(block_array, want_print = true) ⇒ Object



15
16
17
# File 'lib/helper_tools/place_blocks.rb', line 15

def remove_many_blocks(block_array,want_print=true)
  many_blocks_placement("¤ ", block_array, want_print)
end