Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
fix: quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpinet committed Apr 28, 2024
1 parent 1cf4d4f commit 73112ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion back/game/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ function createSocketGame(io) {
} else if (gameState.difficulty === 2) {
newCoord = MCTS.computeMove(gameState, 2);
} else {
throw new Error("Invalid difficulty");
//throw new Error("Invalid difficulty");
// Default to Minimax
newCoord = Minimax.computeMove(gameState, 2);
}
let endTime = performance.now();
let elapsedTime = endTime - startTime;
Expand Down
16 changes: 8 additions & 8 deletions back/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ const server = http.createServer(function (request, response) {
});

// Add cors to the server
server.on("request", (req, res) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
res.setHeader(
"Access-Control-Allow-Headers",
"Content-Type, Authorization, X-Requested-With"
);
});
//server.on("request", (req, res) => {
// res.setHeader("Access-Control-Allow-Origin", "*");
// res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE");
// res.setHeader(
// "Access-Control-Allow-Headers",
// "Content-Type, Authorization, X-Requested-With"
// );
//});

// We need to create a socket server to handle real-time communication.
const io = new Server(server, {
Expand Down

0 comments on commit 73112ca

Please sign in to comment.