From 043237c0adc5bf7b083453e6b45677bd0dc95f4d Mon Sep 17 00:00:00 2001 From: "guillaume.bonabau" Date: Wed, 10 Apr 2024 15:32:17 +0200 Subject: [PATCH] table constructor and instructions --- src/backend/Table.java | 45 +++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/backend/Table.java b/src/backend/Table.java index 18ebbad..f2a8fed 100644 --- a/src/backend/Table.java +++ b/src/backend/Table.java @@ -3,21 +3,42 @@ package backend; import java.util.ArrayList; public class Table { - int vertexCount = 3; - ArrayList> table = new ArrayList<>(vertexCount); + private int height; + private int width; + private ArrayList> table; - //TODO : create constructor + //TODO-INPROGRESS : create constructor + public Table(int height, int width) { + this.height = height; + this.width = width; - public int getCell(int x,int y) { - return table.get(x).add(y); + //initialize the table + int vertexCount = 3; + table = new ArrayList<>(vertexCount); } - //TODO : get(xy) - //TODO : set(xy) + public int getheight() { + return this.height; + } + + public int getwidth() { + return this.width; + } + + //TODO-COMPLETE : create getCell + public Cell getCell(int x,int y) { + //return the Cell object of coordinates x, y + return table.get(x).get(y); + } + //TODO : set(Cell, x, y) set an object Cell to coordinate x, y + //TODO : count around (xy) -> return how many around this cell - //TODO : step : apply game rules for 1 tick () - //TODO : set agent (xy) - //TODO : set random (density) - //TODO : load(filepath) - //TODO : save(filename) + + //TODO : set agent (x y agent) load an agent to coordinates x,y + + //TODO : set random (density) create a random table of determined density + + + //TODO : load(filepath) turn a loaded saveable file into a table + //TODO : save(filename) turn the table into saveable file }