diff --git a/code/index.html b/code/index.html
index 0ad5c1e..338c457 100644
--- a/code/index.html
+++ b/code/index.html
@@ -37,6 +37,7 @@
tab4=[];
tabTotal=[];
mousePos=[];
+ colors=["red","blue","green","brown"];
width=300; // 6 lignes de 50px
height=300; // 6 colonnes de 50px
@@ -116,17 +117,41 @@
function empiler()
{
tabTotal=[];
- tab4.forEach(element => {
- tabTotal.push(element);
- })
- tab3.forEach(element => {
+ const unique = (val) => val.toString() != test.toString();
+ exists=false;
+
+ tab1.forEach(element => {
tabTotal.push(element);
})
tab2.forEach(element => {
- tabTotal.push(element);
+ colors.forEach(col => {
+ test=[element[0],element[1],col];
+ if(!exists)
+ exists=!tabTotal.every(unique);
+ })
+ if(!exists)
+ tabTotal.push(element);
+ exists=false;
})
- tab1.forEach(element => {
- tabTotal.push(element);
+ tab3.forEach(element => {
+ colors.forEach(col => {
+ test=[element[0],element[1],col];
+ if(!exists)
+ exists=!tabTotal.every(unique);
+ })
+ if(!exists)
+ tabTotal.push(element);
+ exists=false;
+ })
+ tab4.forEach(element => {
+ colors.forEach(col => {
+ test=[element[0],element[1],col];
+ if(!exists)
+ exists=!tabTotal.every(unique);
+ })
+ if(!exists)
+ tabTotal.push(element);
+ exists=false;
})
toutDessiner(tabTotal,canvasT,ctxT);