-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain (run this)
55 lines (44 loc) · 1.05 KB
/
main (run this)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#6/9/2020
#Pablo Ibarz
#Random Game
import json
import random
#empty list of ids
ids = []
#parse the steam data
with open('v0001.json', encoding="utf-8") as a:
x = json.load(a)
for a in x.values():
for b in a.values():
for c in b.values():
break
for d in c:
for a, b in d.items():
if a == 'appid':
ids.append(b)
n = input('how many games do you want?\t')
while n.isdigit() == False:
n = input('please enter a number\t')
m = 0
n = int(n)
#empty game list to avoid repeats
g = []
while m < n:
#random id picker
r = ids[random.randint(0, len(ids))]
br = False
for d in c:
for a, b in d.items():
if b == r:
br = True
break
if br == True:
break
#return game
if d['name'] not in g:
print(d['name'] + "\t(url: https://store.steampowered.com/app/" + str(d['appid']) + ")")
g.append([d['name'], d['appid']])
m += 1
inp = input('enter q to quit')
while inp != 'q':
inp = input('enter q to quit')