Mastermind Word Game
How do I make an mastermind word game?
What is a mastermind word game? How do you make a mastermind word game? This script and codes were developed by Event Horizon on 30 July 2022, Saturday.
Mastermind Word Game - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Mastermind Word Game</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container"> <div class="row"> <div class="col-md-12"> <div class="page-header"> <h1>Mastermind Word Game</h1> </div> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-body" id="guessbank"></div> </div> </div> <div class="col-md-12"> <div class="form-group"> <input class="form-control input" placeholder="Type guess here..." type="text" onkeyup="compareAndOutput(this.value);"/> </div> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-body" id="output"></div> </div> </div> </div>
</div> <script src="js/index.js"></script>
</body>
</html>
Mastermind Word Game - Script Codes CSS Codes
.panel{ min-height:2em;
}
.guessbank{ font-weight:bold;
}
.guessbank:nth-child(2n+1){ color:green;
}
.guessbank:nth-child(2n){ color:purple;
}
Mastermind Word Game - Script Codes JS Codes
//Novice , Hard , Master , Expert
var wordList = { 5: ["whizz", "fuzzy", "quick", "quiff", "juked", "puked"], 6: ["fizzes", "buzzes", "sizzle", "jumper", "jabber", "quiver"], 7: ["quizzes", "buzzcut", "schmuck", "quaking", "junkies", "gimmick"], 8: ["quantify", "kickball", "squiggle", "scramjet", "jammiest", "backfill"]
};
//settings
var maxGuesses = 3, guesses = 0,//guesses taken difficulty = 5,//letters in word answer = wordList[difficulty][Math.floor(Math.random() * wordList[difficulty].length)];
//verify words match
var compare = (function(guess, ans) { //if compare is false that means the words do not have the same amount of letters var gArr = guess.split(""),//guess answer aArr = ans.split(""),//actual answer ratio = [], ratioText=0+ "/" + aArr.length; if (gArr.length !== aArr.length) { return ratioText;//incorrect length } for (var i = gArr.length; i--;) { if (gArr[i] !== aArr[i]) { ratio.push(0); //false } else { ratio.push(1); //true } } ratio = ratio.reduce(function(a, b) { return a + b; }, 0); if (ratio === aArr.length) { return "Correct answer!"; } else { ratioText=ratio + "/" + aArr.length return ratioText; }
}); function compareAndOutput(guess){ var output=document.getElementById("output"); output.innerHTML=compare(guess,answer); } var guessbank=document.getElementById("guessbank"); guessbank.innerHTML="Guess Bank: <span class='guessbank'>"+wordList[difficulty].join("</span> <span class='guessbank'>")+"</span>";
Developer | Event Horizon |
Username | Event_Horizon |
Uploaded | July 30, 2022 |
Rating | 3 |
Size | 2,815 Kb |
Views | 62,744 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Only Dropdown | 2,576 Kb |
List Sections | 2,721 Kb |
Tabs | 3,065 Kb |
Window Designing | 5,766 Kb |
KSP altimeter | 3,150 Kb |
Gaming UI | 3,024 Kb |
Simple Drag and Drop | 3,208 Kb |
Like Notification | 1,911 Kb |
Table Generation | 3,609 Kb |
Very Animated Loading Bar | 2,246 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Form Labels | Bartuc | 2,717 Kb |
A Pen by Markku Lehmonen | SharpDal | 7,804 Kb |
React TODO | Enieste | 3,320 Kb |
Jochaho Skeleton | Dhanushbadge | 1,689 Kb |
Pure CSS Read More Arrow | Zephyr | 1,747 Kb |
Svg animation draw | SzymonDziewonski | 5,545 Kb |
Opening Reveal Modal On Document Ready | Winghouchan | 1,787 Kb |
Animated SVG stroke-dasharray | Netsi1964 | 3,179 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Animated bar chart | CreativePunch | 3,124 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!