From 5f8a76828397ce7dc31fe94b261c3b3fef213d8a Mon Sep 17 00:00:00 2001 From: "guillaume.bonabau" Date: Wed, 10 Apr 2024 17:05:12 +0200 Subject: [PATCH] fixed errors in table --- src/backend/Table.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/Table.java b/src/backend/Table.java index a72e15e..a078ba1 100644 --- a/src/backend/Table.java +++ b/src/backend/Table.java @@ -31,8 +31,8 @@ public class Table { return table.get(x).get(y); } //TODO-complete : set(Cell, x, y) set an object Cell to coordinate x, y - public void setCell(Cell cell, int x int y){ - this.table.get(x).get(y) = cell; + public void setCell(Cell cell, int x, int y){ + this.table.get(x).set(y,cell); } //TODO-complete : count near (xy) -> return how many cells around this cell public int countNear(int x, int y){ @@ -40,13 +40,13 @@ public class Table { // if border is true for (int i = x-1;i<=x+1;i++){ for (int j = y-1;j<=y+1;y++){ - if not(i == j){ - this.table.getCell(i,j).getValue +=cellCount; + if (!(i == j)){ + cellCount += this.getCell(i,j).getValue(); } } } - + return cellCount; //if border is false }