(i)
| 15 | }; |
| 16 | |
| 17 | renderSquare(i) { |
| 18 | const x = i % 8; |
| 19 | const y = Math.floor(i / 8); |
| 20 | |
| 21 | return ( |
| 22 | <div key={i} style={{ width: '12.5%', height: '12.5%' }}> |
| 23 | <BoardSquare x={x} y={y}> |
| 24 | {this.renderPiece(x, y)} |
| 25 | </BoardSquare> |
| 26 | </div> |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | renderPiece(x, y) { |
| 31 | const [knightX, knightY] = this.props.knightPosition; |