Logique
Boucles
Math
Texte
Listes
Données
Variables
Fonctions
Programmation
p5.js
Objets web
Propriétés
Formes
Tortue
Apparence
GeoGebra
var canevas, x, y, matrice, format, i, dim, nb, _C3_A9l_C3_A9ment, tableau, gliss; /** * Fonction exécutée une fois, au départ */ function actions_initiales() { document.body.style.paddingLeft="40px"; createElement("h1",'Tableau avec format redéfini'); gliss=nouvelleGlissiereValeur('Dimension',0,30,11,1); createSpan("<br>"); createSpan("<br>"); tableau=creerAffichageListes([],1,"PIXELS","INACTIVEE",500,24); } /** * Fonction exécutée périodiquement, de façon répétée */ function actions_en_boucle() { dim = valeurPrudent("gliss",gliss) - 1; matrice = []; format = []; for (i = 0; i <= dim; i += abs(1)) { matrice.push([]); format.push([]); } nb = 0; for (x = 0; x <= dim; x += abs(1)) { for (y = 0; y <= dim; y += abs(1)) { (matrice[y])[x] = nb; if (x % 2 == 0 || y % 2 == 0) { (format[y])[x] = 'color:orange;background:white;padding:10px'; } else { (format[y])[x] = 'color:white;background:orange;padding:10px'; } nb = (typeof nb == 'number' ? nb : 0) + 1; } } afficherListesFormat(matrice,format,tableau); }