old_contents: #!/usr/bin/env python
  
  import sys
  
  class Grid(object):
  
      def __init__(self):
          self.board = [[None] * 10 for i in range(22)]
          self.score = 0
          self.lines_clear = 0
  
      def draw_board(self):
  
          current_board = self.board
          
          for row in current_board:
              row = map(lambda cell: '.' if cell == None else y, row)
              print ' '.join(row)
  
      def given(self):
          self.board = []
          for row in range(0,22):
              self.board.append(raw_input())
  
      def clear(self):
          self.board = ['. '*10 for row in range(0,22)]
  
      def show_score(self):
          print self.score
  
      def show_clear_lines(self):
          print self.lines_clear
  
  def main():
      
      grid = Grid()
  
      commands = {'p': grid.draw_board, 
                  'g': grid.given, 
                  'c': grid.clear,
                  '?s': grid.show_score,
                  '?n': grid.show_clear_lines}
  
      while True:
          command =  raw_input()
          if command == 'q':
              break
          commands[command]()
          
  
  
  if __name__ == '__main__':
      main()
new_contents: #!/usr/bin/env python
  
  import sys
  
  class Grid(object):
  
      def __init__(self):
          self.board = [[None] * 10 for i in range(22)]
          self.score = 0
          self.lines_clear = 0
  
      def draw_board(self):
  
          current_board = self.board
          
          for row in current_board:
              row = map(lambda cell: '.' if cell == None else cell, row)
              print ' '.join(row)
  
      def given(self):
          
          for index, row in enumerate(self.board):
              self.board[index] = [None if cell == '.' else cell for cell in raw_input() if cell != ' ']
  
      def clear(self):
          self.board = [[None] * 10 for i in range(22)]
  
      def show_score(self):
          print self.score
  
      def show_clear_lines(self):
          print self.lines_clear
  
      def step(self):
          for index, row in enumerate(self.board):
              if all(row) and row[0] != None:
                  self.board[index] = [None] * 10
                  self.score += 100
                  self.lines_clear += 1
  
  
  
  def main():
      
      grid = Grid()
  
      commands = {'p' : grid.draw_board, 
                  'g' : grid.given, 
                  'c' : grid.clear,
                  '?s': grid.show_score,
                  '?n': grid.show_clear_lines,
                  's' : grid.step}
  
      while True:
          command =  raw_input()
          if command == 'q':
              break
          commands[command]()
          
  
  
  if __name__ == '__main__':
      main()
subject: Update rest of functions with new data structure; Passes Test 8