Fix error on cell toggle before step

This commit is contained in:
Frostbide
2025-06-26 01:02:31 -07:00
parent c14d0ed4e1
commit 6cf3cfd3ea

View File

@@ -229,6 +229,8 @@ const moduleFuncs = {
constructor(size) {
this.size = size;
this.grid = this.createGrid();
this.history = [this.cloneGrid(this.grid)];
this.currentStep = 0;
}
createGrid() {
@@ -286,11 +288,6 @@ const moduleFuncs = {
}
step(n = 1) {
if (!this.history) {
this.history = [this.cloneGrid(this.grid)];
this.currentStep = 0;
}
if (n === 0) return;
if (n > 0) {
@@ -341,7 +338,7 @@ module.exports = {
...moduleFuncs,
data: new SlashCommandBuilder()
.setName('gameoflife')
.setDescription("Simulates conway's game of life (In development)")
.setDescription("Simulates conway's game of life")
.addIntegerOption((option) =>
option
.setName('size')