fix de l'ordre des soumissions

This commit is contained in:
Haïssous Kayyissa 2023-04-05 16:35:52 +02:00
parent c313f2846e
commit a1622fa86c
2 changed files with 7 additions and 4 deletions

View File

@ -39,6 +39,7 @@ public class GameView extends View {
//affichage des anciennes soumissions //affichage des anciennes soumissions
LinkedList<Integer> grille = new LinkedList<Integer>(); LinkedList<Integer> grille = new LinkedList<Integer>();
grille.addAll(this.grille.getSoumissions()); grille.addAll(this.grille.getSoumissions());
System.out.println(grille.size());
for (int y=0; y<10;y++) { for (int y=0; y<10;y++) {
for (int x=0;x<4;x++) { for (int x=0;x<4;x++) {
this.circle.setColor(grille.pop()); this.circle.setColor(grille.pop());

View File

@ -21,12 +21,14 @@ public class Grille {
} }
public void addSoumission(LinkedList<Integer> newSub){ public void addSoumission(LinkedList<Integer> newSub){
if (this.sizeSubs<10) {
for (int i = 4; i > 0; i--) { for (int i = 4; i > 0; i--) {
System.out.println("i="+i+", new sub="+newSub); this.soumissions.remove(0);
this.soumissions.set(this.soumissions.size()-this.sizeSubs*4-i,newSub.pop()); this.soumissions.addLast(newSub.poll());
} }
this.sizeSubs += 1; this.sizeSubs += 1;
} }
}
public void initGrille(Collection<Integer> SubToCopy){ public void initGrille(Collection<Integer> SubToCopy){
for(int i=0;i<10;i++){ for(int i=0;i<10;i++){