I have a dictionary:
squares = {
          'r1c1':{'location':[0,0,150,150],'status':'o'},
          'r1c2':{'location':[150,0,300,150],'status':None},
          'r1c3':{'location':[300,0,450,150],'status':None},
          'r2c1':{'location':[0,150,150,300],'status':'x'},
          'r2c2':{'location':[150,150,300,300],'status':'x'},
          'r2c3':{'location':[300,150,450,300],'status':'x'},
          'r3c1':{'location':[0,300,150,450],'status':None},
          'r3c2':{'location':[150,300,300,450],'status':None},
          'r3c3':{'location':[300,300,450,450],'status':'o'}
          }
Ignore location. R stands for row; C stands for column. I want to know if there is a compact function I can use to check if all all rows, columns, or diagonals have the same value ... think TicTacToe ... As of now, I have it all in a big if statement:
def TicTacToe(self):
    #rows
    if self.squares['r1c1']['status'] == 'x' and self.squares['r1c2']['status'] == 'x' and self.squares['r1c3']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r2c1']['status'] == 'x' and self.squares['r2c2']['status'] == 'x' and self.squares['r2c3']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r3c1']['status'] == 'x' and self.squares['r3c2']['status'] == 'x' and self.squares['r3c3']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c1']['status'] == 'o' and self.squares['r1c2']['status'] == 'o' and self.squares['r1c3']['status'] == 'o':
        self.gameOver('o')
    elif self.squares['r2c1']['status'] == 'o' and self.squares['r2c2']['status'] == 'o' and self.squares['r2c3']['status'] == 'o':
        self.gameOver('o')
    elif self.squares['r3c1']['status'] == 'o' and self.squares['r3c2']['status'] == 'o' and self.squares['r3c3']['status'] == 'o':
        self.gameOver('o')
    #columns
    elif self.squares['r1c1']['status'] == 'x' and self.squares['r2c1']['status'] == 'x' and self.squares['r3c1']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c2']['status'] == 'x' and self.squares['r2c2']['status'] == 'x' and self.squares['r3c2']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c3']['status'] == 'x' and self.squares['r2c3']['status'] == 'x' and self.squares['r3c3']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c1']['status'] == 'o' and self.squares['r2c1']['status'] == 'o' and self.squares['r3c1']['status'] == 'o':
        self.gameOver('o')
    elif self.squares['r1c2']['status'] == 'o' and self.squares['r2c2']['status'] == 'o' and self.squares['r3c2']['status'] == 'o':
        self.gameOver('o')
    elif self.squares['r1c3']['status'] == 'o' and self.squares['r2c3']['status'] == 'o' and self.squares['r3c3']['status'] == 'o':
        self.gameOver('o')
    #diagonal
    elif self.squares['r1c1']['status'] == 'x' and self.squares['r2c2']['status'] == 'x' and self.squares['r3c3']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c3']['status'] == 'x' and self.squares['r2c2']['status'] == 'x' and self.squares['r3c1']['status'] == 'x':
        self.gameOver('x')
    elif self.squares['r1c1']['status'] == 'o' and self.squares['r2c2']['status'] == 'o' and self.squares['r3c3']['status'] == 'o':
        self.gameOver('o')
    elif self.squares['r1c3']['status'] == 'o' and self.squares['r2c2']['status'] == 'o' and self.squares['r3c1']['status'] == 'o':
        self.gameOver('o')
But this is ugly and I want to do better. Any ideas?...
 
     
     
     
    