-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_testing.py
More file actions
executable file
·74 lines (55 loc) · 2.86 KB
/
Copy pathsetup_testing.py
File metadata and controls
executable file
·74 lines (55 loc) · 2.86 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 26 21:32:37 2*22
things for testing purposes
@author: dlevitas
"""
from __future__ import division
import platform, shlex
import subprocess as subp
#Determine Monitor Resolution:
if platform.system() == "Windows":
from win32api import GetSystemMetrics
w_pix, h_pix = GetSystemMetrics(0), GetSystemMetrics(1)
elif platform.system() == "Darwin":
p = subp.Popen(shlex.split("system_profiler SPDisplaysDataType"), stdout=subp.PIPE)
output = subp.check_output(('grep', 'Resolution'), stdin=p.stdout)
if '@' in output:
w_pix, h_pix = [int(x.strip(" ")) for x in output.split(':')[-1].split("@")[0].split(' x ')]
elif 'Retina' in output:
w_pix, h_pix = [int(x) for x in output.split(":")[-1].split("Retina")[0:1][0].split(' x ')]
elif 'QHD/WQHD - Wide Quad High Definition' in output:
w_pix, h_pix = [int(x) for x in output.split(":")[-1].split("(QHD/WQHD - Wide Quad High Definition)")[0:1][0].split(' x ')]
elif platform.system() == "Linux":
output = subp.check_output("xdpyinfo | grep -oP 'dimensions:\s+\K\S+'", shell=True).decode("utf-8")
w_pix = output.split("x")[0]
h_pix = output.split("x")[-1].split("\n")[0]
print(w_pix, h_pix)
grid = ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(0,3,1,1,4,1,1,1,4,1,1,1,1,1,1,4,1,1,1,4,1,1,3,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,4,1,1,4,1,1,1,5,1,1,1,1,1,1,5,1,1,1,4,1,1,4,0),
(0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0),
(0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0),
(0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0),
(0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0),
(0,4,1,1,4,1,1,1,5,1,1,1,1,1,1,5,1,1,1,4,1,1,4,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,4,1,1,1,4,0,0,2,0),
(0,2,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,2,0),
(0,3,1,1,4,1,1,1,4,1,1,1,1,1,1,4,1,1,1,4,1,1,3,0),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))
moveable_spaces = 0
for row in range(len(grid)):
for col in range(len(grid[row])):
if grid[row][col] == 5:
print(col*36,row*36)
if grid[row][col] != 0:
moveable_spaces += 1
print("")
print("There are {} moveable spaces in this grid".format(moveable_spaces))