<commit_before># A Nested Array to Model a Bingo Board SOLO CHALLENGE

# I spent [.5] hours on this challenge.

# Release 0: Pseudocode
# Outline:
# => initialize
# =>   initialize input array
# =>   initialize an array of BINGO letters
# => call_spaces
# =>   randomly generate letter (BINGO)
# =>   randomly generate number (1-100)
# =>   call letter and number in single string
# => check_board
# =>   use generated letter to determine column
# =>   check if corresponding number is on the board
# =>   if it is, replace that number with an 'X'
# => display_board
# =>   display new board
# =>   try to remove the array brackets and commas
# =>   bonus: add characters like dots to frame

# board = [[00, 01, 02, 03, 04],
#         [10, 11, 12, 13, 14],
#         [20, 21, 22, 23, 24],
#         [30, 31, 32, 33, 34],
#         [40, 41, 42, 43, 44]]

# Initial Solution

class BingoBoard
  
  def initialize(board)
    @bingo_board = board
    @bingo = ["B","I","N","G","O"]
    @column = 0
  end

  def call_spaces
    # randomly generate letter (BINGO)
       @letter = @bingo.shuffle[0]
    # randomly generate number (1-100)
       @number = rand(1..100)
    # call combination of letter and number
       p "The next space is " + "#{@letter}" + "#{@number}... " + "#{@letter}" + "#{@number}" + "."

  end

  def check_board
    # use generated letter to determine column number
      if @letter == "B"
        @column == 0
      elsif @letter == "I"
        @column == 1
      elsif @letter == "N"
        @column == 2
      elsif @letter == "G"
        @column == 3
      else
        @column = 4
      end
    # check if corresponding number is on the board
      bingo_transpose = @bingo_board.transpose
      require 'matrix'
      mat = Matrix[*bingo_transpose]
      mat.column[@column].to_a
      mat.include?(@number)
    # if it is, replace that number with an 'X'
  end

  def display_board
    
  end

end

# Refactored Solution

<commit_msg>attempt one at board<commit_after># A Nested Array to Model a Bingo Board SOLO CHALLENGE

# I spent [.5] hours on this challenge.

# Release 0: Pseudocode
# Outline:
# => initialize
# =>   initialize input array
# =>   initialize an array of BINGO letters
# => call_spaces
# =>   randomly generate letter (BINGO)
# =>   randomly generate number (1-100)
# =>   call letter and number in single string
# => check_board
# =>   use generated letter to determine column
# =>   check if corresponding number is on the board
# =>   if it is, replace that number with an 'X'
# => display_board
# =>   display new board
# =>   try to remove the array brackets and commas
# =>   bonus: add characters like dots to frame

# board = [[00, 01, 02, 03, 04],
#         [10, 11, 12, 13, 14],
#         [20, 21, 22, 23, 24],
#         [30, 31, 32, 33, 34],
#         [40, 41, 42, 43, 44]]

# Initial Solution

class BingoBoard
  
  def initialize(board)
    @bingo_board = board
    @bingo = [0,1,2,3,4]
    @bingo_letters = { 0: "B", 1: "I", 2: "N", 3: "G", 4: "O" }
    @column = 0
  end

  def call_spaces
    # randomly generate letter (BINGO)
       @letter = @bingo.shuffle[0]
    # randomly generate number (1-100)
       @number = rand(1..100)
    # call combination of letter and number
       p "The next space is " + "#{@letter}" + "#{@number}... " + "#{@letter}" + "#{@number}" + "."

  end

  def check_board
    # use generated letter to determine column number
      @column = @bingo_letters[@letter]
    # check if corresponding number is on the board
      @bingo_board.map do |element|
        if element[@letter] == @number
    # if it is, replace that number with an 'X'
          element[@letter] = "X"
      end
  end

  def display_board
    return bingo_board
  end

end

# Refactored Solution


{'fraction_non_alphanumeric': 0.1286207812915227, 'fraction_numerical': 0.03906457613606165, 'mean_word_length': 2.588179218303146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '483001', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1218, 'n_words': 445}