Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
solve lights when idling
Browse files Browse the repository at this point in the history
  • Loading branch information
TimShaw1 committed Jul 6, 2023
1 parent dedde59 commit e305b17
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion last_area.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Outside
Storage
2 changes: 1 addition & 1 deletion last_task.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nothing. No tasks completed yet
Fix Lights in None
14 changes: 8 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ def idle(G):
break
nearest = move_to_nearest_node(graph)
destination = choice(move_list)
if "Fix Lights" in data["tasks"]:
urgent = is_urgent_task()
data = getGameData()
if "Fix Lights" in data["tasks"] and urgent is None:
dict = load_dict()
loc = "Electrical(10/-11)" if data["map_id"].upper() != "SHIP" else "Electrical"
destination = tuple(dict["Fix Lights"][loc])
urgent = is_urgent_task()
urgent = ("Fix Lights", "Electrical(10/-11)")
if urgent is not None:
dict = load_dict()
destination = tuple(dict[urgent[0]][urgent[1]])
Expand All @@ -77,6 +79,8 @@ def idle(G):
urgent = is_urgent_task()
if urgent is not None and move_return_code == 0:
urgent = is_urgent_task()
if "Fix Lights" in data["tasks"]:
urgent = ("Fix Lights", "Electrical(10/-11)")
if urgent is not None:
solve_task(urgent[0])
nearest = move_to_nearest_node(graph)
Expand Down Expand Up @@ -258,8 +262,6 @@ def main(G) -> int:

dead = isDead()

idle(G)

ret = 0
while True:
if isInGame() and not keyboard.is_pressed('`'):
Expand Down Expand Up @@ -290,8 +292,8 @@ def main(G) -> int:
# Load map graph
graph = load_graph_list(data["map_id"])

G = generate_graph(graph)
#G = load_G(data["map_id"])
#G = generate_graph(graph)
G = load_G(data["map_id"])

# Print
print("The Among Us AI\nHold ` for 7 seconds to stop. Press ctrl+alt+del to forcibly stop a task.")
Expand Down
4 changes: 1 addition & 3 deletions task-solvers/Fix Lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
click_close()
raise SystemExit(0)

print(x,y,offset, dimensions)

for i in range(5):
color = screenshot.getpixel((x + i * offset - dimensions[0], y - dimensions[1]))
if color[1] < 100:
pyautogui.click(x + i * offset, y - round(dimensions[3] / 7.5))
time.sleep(0.5)
time.sleep(0.2)

0 comments on commit e305b17

Please sign in to comment.