projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Started code review + some fixes (unfinished)
[vchess.git]
/
client
/
src
/
playCompMove.js
diff --git
a/client/src/playCompMove.js
b/client/src/playCompMove.js
index
b93a8d1
..
d8dd2d4
100644
(file)
--- a/
client/src/playCompMove.js
+++ b/
client/src/playCompMove.js
@@
-1,22
+1,23
@@
// Logic to play a computer move in a web worker
// Logic to play a computer move in a web worker
-onmessage = async function(e)
-{
- switch (e.data[0])
- {
- case "scripts":
+onmessage = async function(e) {
+ switch (e.data[0]) {
+ case "scripts": {
const vModule = await import("@/variants/" + e.data[1] + ".js");
self.V = vModule.VariantRules;
break;
const vModule = await import("@/variants/" + e.data[1] + ".js");
self.V = vModule.VariantRules;
break;
- case "init":
+ }
+ case "init": {
const fen = e.data[1];
self.vr = new self.V(fen);
break;
const fen = e.data[1];
self.vr = new self.V(fen);
break;
+ }
case "newmove":
self.vr.play(e.data[1]);
break;
case "newmove":
self.vr.play(e.data[1]);
break;
- case "askmove":
+ case "askmove":
{
const compMove = self.vr.getComputerMove();
postMessage(compMove);
break;
const compMove = self.vr.getComputerMove();
postMessage(compMove);
break;
+ }
}
}
-}
+}
;