Skip to content

Commit

Permalink
Merge pull request #238 from XavierTho/main
Browse files Browse the repository at this point in the history
Period 3 Scrum Master Spencer
  • Loading branch information
XavierTho authored Nov 21, 2024
2 parents def2c07 + 08caf8a commit b8137c0
Showing 1 changed file with 39 additions and 32 deletions.
71 changes: 39 additions & 32 deletions navigation/share_and_care/chess/hangout.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,38 +270,46 @@ authors: Ahaan, Xavier, Spencer, Vasanth
}
}

// Chat functionality
const chatMessages = document.getElementById("chatMessages");
const messageInput = document.getElementById("messageInput");
const sendBtn = document.getElementById("sendBtn");

function addMessage(content, type = "user") {
const messageDiv = document.createElement("div");
messageDiv.classList.add("message", type === "user" ? "user-message" : "bot-message");
messageDiv.textContent = content;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
// Chat functionality
const chatMessages = document.getElementById("chatMessages");
const messageInput = document.getElementById("messageInput");
const sendBtn = document.getElementById("sendBtn");

function addMessage(content, type = "user") {
const messageDiv = document.createElement("div");
messageDiv.classList.add("message", type === "user" ? "user-message" : "bot-message");
messageDiv.textContent = content;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}

sendBtn.addEventListener("click", () => {
const message = messageInput.value.trim();
if (message) {
addMessage(message, "user");
messageInput.value = "";
setTimeout(botResponse, 2000);
}
});

function botResponse() {
const motivationalMessages = [
"Keep it up! Your next move could be a game-changer.",
"Great effort! Remember, every master was once a beginner.",
"You're doing fantastic. Stay focused and enjoy the game!",
];
const randomMessage =
motivationalMessages[Math.floor(Math.random() * motivationalMessages.length)];
addMessage(randomMessage, "bot");
}
sendBtn.addEventListener("click", () => {
const message = messageInput.value.trim();
if (message) {
addMessage(message, "user");
messageInput.value = "";
setTimeout(botResponse, 2000); // Bot responds after 2 seconds
}
});

function botResponse() {
const motivationalMessages = [
"Keep it up! Your next move could be a game-changer.",
"Great effort! Remember, every master was once a beginner.",
"You're doing fantastic. Stay focused and enjoy the game!",
"Patience and strategy will always lead to victory!",
"Trust your instincts and keep making moves!",
"Think a few steps ahead, and you'll be unstoppable.",
"Even the best players make mistakes; keep learning and moving forward.",
"Take a deep breath and stay calm – you're doing great!",
"Chess is a journey, enjoy every move you make.",
"Don't rush – a wise move is worth the wait!"
];
const randomMessage =
motivationalMessages[Math.floor(Math.random() * motivationalMessages.length)];
addMessage(randomMessage, "bot");
}


drawBoard();
</script>
Expand All @@ -312,7 +320,6 @@ authors: Ahaan, Xavier, Spencer, Vasanth




<html lang="en">
<head>
<meta charset="UTF-8">
Expand Down

0 comments on commit b8137c0

Please # to comment.