Created
May 12, 2025 12:11
-
-
Save PoignardAzur/7e93ffaad2163f6edcd9b9b4f5f77f6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateSVG(N, M, S) { | |
const rects = []; | |
for (let y = 0; y < M; y++) { | |
for (let x = 0; x < N; x++) { | |
rects.push(`<rect x="${x * S}" y="${y * S}" width="${S}" height="${S}" fill="none" stroke="black" stroke-width="2"/>`); | |
} | |
} | |
const width = N * S; | |
const height = M * S; | |
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">${rects.join('')}</svg>`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment