1414
1515time .sleep (4 )
1616
17- colors = ["b" , "g" , "r" , "p" , "y" , "G" , "e" , "s" , "t" , "P" , "h" , "c" , "S" , "l" , "w" , "o" , "W" , "C" , "f" , "B" ]
17+ colors = ["n" , " b" , "g" , "r" , "p" , "y" , "G" , "e" , "s" , "t" , "P" , "h" , "c" , "S" , "l" , "w" , "o" , "W" , "C" , "f" , "B" ]
1818colorinstructions = [
19+ "pass" ,
1920 "mouse.position = (mouse.position[0] + 1.5, mouse.position[1] - 22.8)" ,
2021 "mouse.position = (mouse.position[0] + 11.9, mouse.position[1] - 21.5)" ,
2122 "mouse.position = (mouse.position[0] + 19.4, mouse.position[1] - 16.8)" ,
7879 ypos += s
7980
8081def place (queue ):
82+ # Group datapoints by modifier first, then by color within each modifier group
83+ modifier_groups = {}
8184 for datapoint in queue :
8285 modifier = datapoint [0 ]
86+ if modifier not in modifier_groups :
87+ modifier_groups [modifier ] = {}
8388 color = datapoint [1 ]
84- x = datapoint [2 ]
85- y = datapoint [3 ]
86- mouse .position = (int (x ) + 404 , int (y ) + 179 )
87- time .sleep (0.01 )
89+ if color not in modifier_groups [modifier ]:
90+ modifier_groups [modifier ][color ] = []
91+ modifier_groups [modifier ][color ].append (datapoint )
92+
93+ # Process each modifier group
94+ for modifier in modifier_groups :
95+ # Set modifier once for this group
8896 controller .press ("`" )
8997 time .sleep (0.01 )
9098 controller .tap ("x" )
9199 time .sleep (0.01 )
92- if color != colorheld :
93- colorheld = color
100+ controller .press ("z" )
101+ time .sleep (0.01 )
102+ exec (modifierinstructions [modifiers .index (modifier )])
103+ time .sleep (0.01 )
104+ controller .release ("z" )
105+ time .sleep (0.01 )
106+
107+ # Process each color group within this modifier
108+ for color in modifier_groups [modifier ]:
109+ # Set color once for this group
94110 controller .press ("c" )
95111 time .sleep (0.01 )
96112 exec (colorinstructions [colors .index (color )])
97113 time .sleep (0.01 )
98114 controller .release ("c" )
99- else :
100- controller .press ("c" )
101- time .sleep (0.03 )
102- controller .release ("c" )
103- if modifier != modifierheld :
104- modifierheld = modifier
105- controller .press ("z" )
106- time .sleep (0.01 )
107- exec (modifierinstructions [modifiers .index (modifier )])
108115 time .sleep (0.01 )
109- controller .release ("z" )
110- else :
111- controller .press ("z" )
112- time .sleep (0.03 )
113- controller .release ("z" )
116+
117+ # Place all walls with this modifier+color combination
118+ for datapoint in modifier_groups [modifier ][color ]:
119+ x = datapoint [2 ]
120+ y = datapoint [3 ]
121+ mouse .position = (int (x ) + 404 , int (y ) + 179 )
122+ time .sleep (0.01 )
123+ controller .tap ("x" )
124+
125+ controller .release ("`" )
114126 time .sleep (0.01 )
115127
116128place (buildqueue )
0 commit comments