MCPcopy
hub / github.com/TencentQQGYLab/AppAgent / area_to_xy

Function area_to_xy

scripts/task_executor.py:117–139  ·  view source on GitHub ↗
(area, subarea)

Source from the content-addressed store, hash-verified

115
116
117def area_to_xy(area, subarea):
118 area -= 1
119 row, col = area // cols, area % cols
120 x_0, y_0 = col * (width // cols), row * (height // rows)
121 if subarea == "top-left":
122 x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) // 4
123 elif subarea == "top":
124 x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) // 4
125 elif subarea == "top-right":
126 x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) // 4
127 elif subarea == "left":
128 x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) // 2
129 elif subarea == "right":
130 x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) // 2
131 elif subarea == "bottom-left":
132 x, y = x_0 + (width // cols) // 4, y_0 + (height // rows) * 3 // 4
133 elif subarea == "bottom":
134 x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) * 3 // 4
135 elif subarea == "bottom-right":
136 x, y = x_0 + (width // cols) * 3 // 4, y_0 + (height // rows) * 3 // 4
137 else:
138 x, y = x_0 + (width // cols) // 2, y_0 + (height // rows) // 2
139 return x, y
140
141
142while round_count < configs["MAX_ROUNDS"]:

Callers 1

task_executor.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected