-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcraft.py
21 lines (19 loc) · 879 Bytes
/
craft.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import asyncio
import random
import time
from infinitecraft import InfiniteCraft
async def main():
async with InfiniteCraft() as game:
while True:
await asyncio.sleep(0.1)
i = random.randint(0, len(game.discoveries))
j = random.randint(0, len(game.discoveries))
if i < len(game.discoveries) - 1 and j < len(game.discoveries) - 1:
result = await game.pair(game.discoveries[i], game.discoveries[j])
print(f"{result} = {game.discoveries[i]} + {game.discoveries[j]}. TOTAL: {str(len(game.discoveries))}")
file = open("recipies.txt", "a")
file.write(f"\n{result} = {game.discoveries[i]} + {game.discoveries[j]}")
file = open("discoveries.txt", "a")
file.write(f"\n{result}")
if __name__ == "__main__":
asyncio.run(main())