This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pow = 10 | |
fitnessLevel(randomPhrase) { | |
let fitnessLevel = 0 | |
for (let i = 0; i < this.phraseToGuess.length; i++) { | |
// Compare letters | |
if (this.phraseToGuess[i] === randomPhrase[i]) { | |
fitnessLevel++ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const phraseToGuess = 'random phrase' | |
const populationSize = 200 | |
const population = [] | |
// Demo function to pick random latin basic UTF-8 characters | |
// you can see full table here: | |
// https://www.w3schools.com/charsets/ref_utf_basic_latin.asp | |
newChar() { | |
let c = Math.floor(Math.random() * 59) + 63 | |
if (c === 63) c = 32 // change "?" to " " space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Stop following command execution if command before failed | |
set -e | |
#Remove previous bucket if exists | |
delete_previous_version_if_exists() { | |
#We either delete local folder and bucket object or just a bucket | |
rm -r ./your-choosen-folder && | |
gsutil -m rm -r gs://your-production-project/your-choosen-folder || | |
gsutil -m rm -r gs://your-production-project/your-choosen-folder | |
} |
NewerOlder