-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenSpots.py
More file actions
29 lines (22 loc) · 755 Bytes
/
genSpots.py
File metadata and controls
29 lines (22 loc) · 755 Bytes
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
import os
import random
path = 'F:/GAB IV/Paymongo/ooparking-lot'
fileName = "randomSpots.txt"
f = open(fileName,"w+")
sizes = ["S", "M", "L"]
spots = []
for i in range(100):
f.write("(" + str(random.randint(1,10)) + "," + str(random.randint(1,10)) + "," + str(random.randint(1,10)) + "),")
spots.append(i)
f.write("\n\n\n")
for i in range(100):
f.write('"' + str(sizes[random.randint(0,2)]) + '", ')
f.write("\n\n\n")
occupied = random.sample(spots,k=90) # Modify k to number of occupied spots
print("Occupied slots: " + str(len(occupied)))
print("Spots: " + str(len(spots)))
available = [i for i in spots if i not in occupied]
print("Available slots: " + str(len(available)))
f.write(str(occupied))
f.close()
print("Random Spots generated!")