Beispiel #1
0
        #check for blocked cell          
         foundCell=False
         for [x, y] in obstacles:
            if [column, row]==[x,y]:
                foundCell=True 
             
         # for drawing backward diagonals in the squares
         startX = offset + margin
         startX += column * offset

         if (column!=0 and row!=0 and column!=(colLength-1) and row!=(rowLength-1)) and foundCell==False:
            lineColor = black
            pygame.draw.line(screen, lineColor, [startX, startY], [startX - offset, startY + offset], margin)


   edges=graph_new.getAllEdges();
   for i in range (len(edges)):
        node1=[(((edges[i][0]%(colLength-1))+1)*(width+margin)),(((edges[i][0]/(colLength-1))+1)*(width+margin))]
        node2=[(((edges[i][1]%(colLength-1))+1)*(width+margin)),(((edges[i][1]/(colLength-1))+1)*(width+margin))]
        #print str(node1)+" "+str(node2)
        pygame.draw.line(screen, black, (node1[0], node1[1]), (node2[0], node2[1]), 1)
        

       
   child=functions.getVertexID(goal[0], goal[1])
   parents=parent[child]
   if (parents!=-1):
       while(not(parents==functions.getVertexID(start[0], start[1]) and child==functions.getVertexID(start[0], start[1]))):
           xLoc1=(((child%(colLength-1))+1)*(width+margin))
           yLoc1=(((child/(colLength-1))+1)*(width+margin))
           xLoc2=(((parents%(colLength-1))+1)*(width+margin))