Fix error on cell toggle before step
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user