@@ -148,42 +148,50 @@ document.querySelectorAll('.box').forEach(item => {
148148 function whosTurn ( toggle ) {
149149
150150 // PAWN
151-
152151 if ( item . innerText == `${ toggle } pawn` ) {
153- item . style . backgroundColor = 'pink'
154-
152+ item . style . backgroundColor = 'pink' ;
153+
155154 if ( tog % 2 !== 0 && aup < 800 ) {
156-
157155 if ( document . getElementById ( `b${ a + 100 } ` ) . innerText . length == 0 ) {
158- document . getElementById ( `b${ a + 100 } ` ) . style . backgroundColor = 'green'
156+ document . getElementById ( `b${ a + 100 } ` ) . style . backgroundColor = 'green' ;
159157 }
160-
158+
159+ // Check for the initial double move for black pawns (from row 2)
160+ if ( aup < 300 && document . getElementById ( `b${ a + 200 } ` ) . innerText . length == 0 ) {
161+ document . getElementById ( `b${ a + 200 } ` ) . style . backgroundColor = 'green' ;
162+ }
163+
161164 if ( aside < 8 && document . getElementById ( `b${ a + 100 + 1 } ` ) . innerText . length !== 0 ) {
162- document . getElementById ( `b${ a + 100 + 1 } ` ) . style . backgroundColor = 'green'
165+ document . getElementById ( `b${ a + 100 + 1 } ` ) . style . backgroundColor = 'green' ;
163166 }
164-
167+
165168 if ( aside > 1 && document . getElementById ( `b${ a + 100 - 1 } ` ) . innerText . length !== 0 ) {
166- document . getElementById ( `b${ a + 100 - 1 } ` ) . style . backgroundColor = 'green'
167-
169+ document . getElementById ( `b${ a + 100 - 1 } ` ) . style . backgroundColor = 'green' ;
168170 }
169171 }
170-
172+
171173 if ( tog % 2 == 0 && aup > 100 ) {
172-
173174 if ( document . getElementById ( `b${ a - 100 } ` ) . innerText . length == 0 ) {
174- document . getElementById ( `b${ a - 100 } ` ) . style . backgroundColor = 'green'
175+ document . getElementById ( `b${ a - 100 } ` ) . style . backgroundColor = 'green' ;
176+ }
177+
178+ // Check for the initial double move for white pawns (from row 7)
179+ if ( aup > 500 && document . getElementById ( `b${ a - 200 } ` ) . innerText . length == 0 ) {
180+ document . getElementById ( `b${ a - 200 } ` ) . style . backgroundColor = 'green' ;
175181 }
182+
176183 if ( aside < 8 && document . getElementById ( `b${ a - 100 + 1 } ` ) . innerText . length !== 0 ) {
177- document . getElementById ( `b${ a - 100 + 1 } ` ) . style . backgroundColor = 'green'
184+ document . getElementById ( `b${ a - 100 + 1 } ` ) . style . backgroundColor = 'green' ;
178185 }
186+
179187 if ( aside > 1 && document . getElementById ( `b${ a - 100 - 1 } ` ) . innerText . length !== 0 ) {
180- document . getElementById ( `b${ a - 100 - 1 } ` ) . style . backgroundColor = 'green'
181-
188+ document . getElementById ( `b${ a - 100 - 1 } ` ) . style . backgroundColor = 'green' ;
182189 }
183190 }
184-
185-
186191 }
192+
193+
194+
187195
188196 // KING
189197
0 commit comments