turtle.shape(image) screen.setup(width=725, height=491) correct_answer_count = 0 correct_answers = [] input_box_title = "Guess the State" states_data = pandas.read_csv("50_states.csv") all_states = states_data.state.tolist() while correct_answer_count != 50: answer_state = screen.textinput( title=input_box_title, prompt="What's another state's name?").title() # print(states_data.state) # print(answer_state in states_data.state.tolist()) if answer_state == "Exit": missing_states = [ state for state in all_states if state not in correct_answers ] missing_states_df = pandas.DataFrame(missing_states) missing_states_df.to_csv("missing_states.csv") break if answer_state in all_states: state_name = StateName() state_x = int(states_data[states_data.state == answer_state].x) state_y = int(states_data[states_data.state == answer_state].y) state_name.update_state_name(answer_state, state_x, state_y) if answer_state not in correct_answers: correct_answer_count += 1 correct_answers.append(answer_state) input_box_title = f"{correct_answer_count}/50 States Correct"
y = -y q0 = q0_r0 + q0_r1 + sum(q0_spheres, []) + sum(q0_cylinders, []) if args.display: v(q0) # List of nodes composing the assembly sequence nodes = list() # List of rules that define all the nodes rules = list() # List of grasps for each node. From any node to the next one, one grasp is # added or removed grasps = set() # list of nodes that are explored to cross each edge exploreNodes = list() nodes.append(StateName(grasps)) rules.append(makeRule(grasps=grasps)) # grasp sphere0 grasps.add(('r0/gripper', 'sphere0/handle')) nodes.append(StateName(grasps)) rules.append(makeRule(grasps=grasps)) exploreNodes.append(nodes[-2]) # grasp cylinder0 grasps.add(('r1/gripper', 'cylinder0/handle')) nodes.append(StateName(grasps)) rules.append(makeRule(grasps=grasps)) exploreNodes.append(nodes[-2]) # assemble cylinder0 and sphere0 grasps.add(('cylinder0/magnet0', 'sphere0/magnet'))
def getState(cg, nodeName): for n in cg.nodes: if StateName(n) == nodeName: return n raise KeyError(nodeName)