Exemplo n.º 1
0
CANVAS_BACKGROUND_COLOUR = 'white'
# Think frames per seconds, just a milliseconds value of how often to refresh
# the page
SCREEN_REFRESH = 500

# Create the canvas with given sizes
canvas = Canvas(root,
                width = MATRIX_WIDTH,
                height = MATRIX_HEIGHT,
                bg=CANVAS_BACKGROUND_COLOUR)
canvas.pack()

###############################################################################

test_graph = Graph(NODE_NUM_H, NODE_NUM_W, NODE_SIZE, canvas)

test_graph.render()

# TODO: Pass in a tuple instead of a fixed value. It makes no sense for the value to 
# just be one term for a 2D list, instead the Graph should receive a tuple to access the 
# node positions. 
# this should be roughly the center, 20th col in 20th row. 

def unique_list(input):
    """
    # TODO: unique_list - info about function

    - what's it's input
    - whats it's output
    - why is a keyword used :P
Exemplo n.º 2
0
canvas = Canvas(root,
                width = MATRIX_WIDTH,
                height = MATRIX_HEIGHT,
                bg=CANVAS_BACKGROUND_COLOUR)
canvas.pack()

###############################################################################

# TODO: If the robot is set to the edge of the screen the search values will
# overlap (like snake or something bleeding over). Also when this happens teh
# reset method doesn't work.

# Position for the robot to start at while testing
robot_tuple = (35,20)

test_graph = Graph(NODE_NUM_H, NODE_NUM_W, NODE_SIZE, canvas)

test_graph.render()
test_graph.place_robot(robot_tuple)

###############################################################################

def reset_values(t, b, r):
    """Takes input of top and bottom tuples for the search graph and resets them
    to the robot position.

    """
    t = (r[0], r[1])
    b = (r[0], r[1])
    return t, b
Exemplo n.º 3
0
###############################################################################

# Set up the environment with canvas to use

# CREATE MAIN TKINTER ROOT
root = Tk()

canvas = Canvas(root,
                width=G.canvas_width,
                height=G.canvas_height,
                bg=G.canvas_background_colour)
canvas.pack()

# create a graph instance
simulation_graph = Graph(G.matrix_size, G.matrix_size, G.node_size, canvas)

G.random_robot_start_position()

simulation_graph.render()
simulation_graph.place_robot(G.robot_start_position)

###############################################################################

# robot and item_node positions
start_pos = G.robot_start_position

# TODO: This is how many items want to be found by the program. if this is set
# to 1 then only one item is found, if it's set to 4 then 4 will be found etc.
items_to_find = 10
Exemplo n.º 4
0
###############################################################################

# Set up the environment with canvas to use

# CREATE MAIN TKINTER ROOT
root = Tk()

canvas = Canvas(root,
                width = G.canvas_width,
                height = G.canvas_height,
                bg=G.canvas_background_colour)
canvas.pack()

# create a graph instance
simulation_graph = Graph(G.matrix_size,
                         G.matrix_size,
                         G.node_size,
                         canvas)

G.random_robot_start_position()

simulation_graph.render()
simulation_graph.place_robot(G.robot_start_position)

###############################################################################

# robot and item_node positions
start_pos = G.robot_start_position

# TODO: This is how many items want to be found by the program. if this is set
# to 1 then only one item is found, if it's set to 4 then 4 will be found etc.
items_to_find = 10
Exemplo n.º 5
0
canvas = Canvas(root,
                width=MATRIX_WIDTH,
                height=MATRIX_HEIGHT,
                bg=CANVAS_BACKGROUND_COLOUR)
canvas.pack()

###############################################################################

# TODO: If the robot is set to the edge of the screen the search values will
# overlap (like snake or something bleeding over). Also when this happens teh
# reset method doesn't work.

# Position for the robot to start at while testing
robot_tuple = (35, 20)

test_graph = Graph(NODE_NUM_H, NODE_NUM_W, NODE_SIZE, canvas)

test_graph.render()
test_graph.place_robot(robot_tuple)

###############################################################################


def reset_values(t, b, r):
    """Takes input of top and bottom tuples for the search graph and resets them
    to the robot position.

    """
    t = (r[0], r[1])
    b = (r[0], r[1])
    return t, b