Skip to content

Commit 8cf2936

Browse files
committed
Refactor: change parameter
1 parent 19e25c5 commit 8cf2936

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

src/apps/genetic-nn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function setup() {
2525
}
2626

2727
let firstTime = true;
28-
function handleReset(tRexes) {
28+
function handleReset({ tRexes }) {
2929
if (firstTime) {
3030
// Initialize all the tRexes for the very first time.
3131
firstTime = false;

src/apps/genetic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function setup() {
2828
}
2929

3030
let firstTime = true;
31-
function handleReset(tRexes) {
31+
function handleReset({ tRexes }) {
3232
if (firstTime) {
3333
// Initialize all the tRexes with random models
3434
// for the very first time.

src/apps/nn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function setup() {
2121
}
2222

2323
let firstTime = true;
24-
function handleReset(tRexes) {
24+
function handleReset({ tRexes }) {
2525
const tRex = tRexes[0];
2626
if (firstTime) {
2727
firstTime = false;

src/apps/nnm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function setup() {
2121
}
2222

2323
let firstTime = true;
24-
function handleReset(tRexes) {
24+
function handleReset({ tRexes }) {
2525
if (firstTime) {
2626
// Initialize all the tRexes for the very first time.
2727
firstTime = false;

src/apps/random.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function setup() {
2121
}
2222

2323
let firstTime = true;
24-
function handleReset(tRexes) {
24+
function handleReset({ tRexes }) {
2525
if (firstTime) {
2626
firstTime = false;
2727
tRexes.forEach((tRex) => {

src/apps/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function setup() {
1818
runner.init();
1919
}
2020

21-
function handleReset(tRexes) {
21+
function handleReset({ tRexes }) {
2222
// Add initialization of tRexes here.
2323
// This method is called everytime the game restarts.
2424
}

src/game/Runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ export default class Runner {
447447
this.distanceMeter.reset(this.highestScore);
448448
this.horizon.reset();
449449
this.tRexGroup.reset();
450-
this.config.onReset(this.tRexGroup.tRexes);
450+
this.config.onReset({ tRexes: this.tRexGroup.tRexes });
451451
this.update();
452452
} else {
453453
this.isFirstTime = true;
454454
this.tRexGroup.reset();
455-
this.config.onReset(this.tRexGroup.tRexes);
455+
this.config.onReset({ tRexes: this.tRexGroup.tRexes });
456456
if (!this.playing) {
457457
this.playing = true;
458458
this.update();

0 commit comments

Comments
 (0)