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

# I spent [8] hours on this challenge.


# Release 0: Pseudocode
# Outline:
#   create method that calls random letter in word "Bingo" and a random number from 1-100
#   when the letter and number corresponds to the board replace that number with an X
#   display the board as a board with the replacements

# Create a method to generate a letter ( b, i, n, g, o) and a number (1-100)
  # make an array containing letters b, i, n, g, o and use .sample to randomize
  # create a variable that uses random on a range of numbers 1-100

# Check the called column for the number called.
  # use a case statement for what letter is called
  # make each letter correspond to each index in each array within the board

# If the number is in the column, replace with an 'x'
  # using the case statement above if the number called is in the arrays within board
  # replace that number with an X

# Display a column to the console
  #

# Display the board to the console (prettily)
  # call the new board to the console and display it correctly

# Initial Solution

class BingoBoard
  
  attr_accessor :bingo_board
  attr_reader :letter
  attr_accessor :number
  
  def initialize(board)
    @bingo_board = board
  end
  
  def show_board
    p @bingo_board[0]
    p @bingo_board[1]
    p @bingo_board[2]
    p @bingo_board[3]
    p @bingo_board[4]
  end

  def call
    @letter = ["B", "I", "N", "G", "O"].sample
    @number = rand(1..100)
    puts "Call! #{@letter},#{@number}"
    5.times do
    print "."
    sleep 0.1
    end
    sleep 0.8
    puts
  end

  def check
    case @letter
    when "B"
      if @bingo_board.transpose[0].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      else
        puts "Not on the board! Try again!"
        puts
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      end
    when "I"
      if @bingo_board.transpose[1].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      else
        puts "Not on the board! Try again!"
        puts
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      end
    when "N"
      if @bingo_board.transpose[2].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      else
        puts "Not on the board! Try again!"
        puts
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      end
    when "G"
      if @bingo_board.transpose[3].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      else
        puts "Not on the board! Try again!"
        puts
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      end
    when "O"
      if @bingo_board.transpose[4].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      else
        puts "Not on the board! Try again!"
        puts
        p @bingo_board[0]
        p @bingo_board[1]
        p @bingo_board[2]
        p @bingo_board[3]
        p @bingo_board[4]
      end
    end
  end

  def auto_play
    until @bingo_board.each{ |a| a.each{ |num| num.is_a?(String)}} == true<commit_msg>Edit solo<commit_after># A Nested Array to Model a Bingo Board SOLO CHALLENGE

# I spent [8] hours on this challenge.


# Release 0: Pseudocode
# Outline:
#   create method that calls random letter in word "Bingo" and a random number from 1-100
#   when the letter and number corresponds to the board replace that number with an X
#   display the board as a board with the replacements

# Create a method to generate a letter ( b, i, n, g, o) and a number (1-100)
  # make an array containing letters b, i, n, g, o and use .sample to randomize
  # create a variable that uses random on a range of numbers 1-100

# Check the called column for the number called.
  # use a case statement for what letter is called
  # make each letter correspond to each index in each array within the board

# If the number is in the column, replace with an 'x'
  # using the case statement above if the number called is in the arrays within board
  # replace that number with an X

# Display a column to the console
  #

# Display the board to the console (prettily)
  # call the new board to the console and display it correctly

# Initial Solution

class BingoBoard
  
  attr_accessor :bingo_board
  attr_reader :letter
  attr_accessor :number
  
  def initialize(board)
    @bingo_board = board
  end
  
  def show_board
    p @bingo_board[0]
    p @bingo_board[1]
    p @bingo_board[2]
    p @bingo_board[3]
    p @bingo_board[4]
  end

  def call
    @letter = ["B", "I", "N", "G", "O"].sample
    @number = rand(1..100)
    puts "Call! #{@letter},#{@number}"
    5.times do
    print "."
    sleep 0.1
    end
    sleep 0.8
    puts
  end

  def check
    case @letter
    when "B"
      if @bingo_board.transpose[0].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        show_board
      else
        puts "Not on the board! Try again!"
        puts
        show_board
      end
    when "I"
      if @bingo_board.transpose[1].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        show_board
      else
        puts "Not on the board! Try again!"
        puts
        show_board
      end
    when "N"
      if @bingo_board.transpose[2].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        show_board
      else
        puts "Not on the board! Try again!"
        puts
        show_board
      end
    when "G"
      if @bingo_board.transpose[3].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        show_board
      else
        puts "Not on the board! Try again!"
        puts
        show_board
      end
    when "O"
      if @bingo_board.transpose[4].include?(@number)
        @bingo_board.each{ |a| a.map!{ |num| num == @number ? 'X' : num}}
        show_board
      else
        puts "Not on the board! Try again!"
        puts
        show_board
      end
    end
  end

  def auto_play
    until @bingo_board.each{ |a| a.each{ |num| num.is_a?(String)}} == true
{'fraction_non_alphanumeric': 0.10583333333333333, 'fraction_numerical': 0.01611111111111111, 'mean_word_length': 2.249548736462094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3916875', 'n_tokens_mistral': 2542, 'n_tokens_neox': 2525, 'n_words': 842}