Shigoto-dev19 / ZK-Battleships-Solana

First decentralized & private Battleships game on Solana. Honorable Mention recognition in Solana Grizzlython Hackathon
https://solana.com/news/solana-grizzlython-winners?utm_source=Iterable&utm_medium=email&utm_campaign=campaign_6567415#:~:text=Pet%20Legends-,Zk%20Battleships,-Little%20Bonkers
23 stars 4 forks source link

Initializing F is a drag on performance #1

Closed ananas-block closed 1 year ago

ananas-block commented 1 year ago

https://github.com/Shigoto-dev19/ZK-Battleships-Solana/blob/39e42bc8ee11b75b3559b9ad005c97b33dc9baf3/src/gameSimulation.ts#L64

make it a parameter in the class, initialize it once, then use it with this.F

Shigoto-dev19 commented 1 year ago

true, It's better to initialize it outside of the class

ananas-block commented 1 year ago

do it in the initialization function

ananas-block commented 1 year ago

and pass it into the constructor, the constructor will assign it to an attribute constructor(F) { this.F = F; }