f4

来源:互联网 发布:手机发布淘宝宝贝 编辑:程序博客网 时间:2024/04/30 01:03

   if j - 4 >= 0 and i - 4 >= 0:
        x,y = i,j
        print "i,j",i,j
        s = 0
        for z in range(5):
            s += cross[x][y]
            x-=1;y+=1
        print "s:",s
        if s == 5 or s == -5:
            return True
    if j - 4 >= 0 and i + 4 <= NUMLINESHORIZONTAL-1:
        x,y = i,j
        print "i,j",i,j
        s = 0
        for z in range(5):
            s += cross[x][y]
            x+=1;y-=1
        print "s:",s
        if s == 5 or s == -5:
            return True
       

def is_win(cross,i,j):
    if around_check(cross,i,j) == True:
        return True
    return False

def makeText(text, color, bgcolor, top, left):
    # create the Surface and Rect objects for some text.
    textSurf = BASICFONT.render(text, True, color, bgcolor)
    textRect = textSurf.get_rect()
    textRect.topleft = (top, left)
    return (textSurf, textRect)               

def get_local_ip():
    csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    csock.connect(('8.8.8.8', 80))       
    (addr, port) = csock.getsockname()       
    csock.close()
    return addr