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
// Land is represented as # | |
// water is - | |
// Land that connected on at least one side with another land belongs to the same island. | |
// Get the count of islands. | |
const map1 = ` | |
------ | |
--###- | |
---##- |
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
// Crack caesard encoded sentences. | |
// By find which letter is E. | |
// E is letter the most used in french. | |
function crack(caesarCode) { | |
const matrix = {}; | |
const caesarCodeArray = caesarCode.toUpperCase().split('') | |
caesarCodeArray.filter(e => e !== " ").forEach(e => { | |
if(matrix[e]) { | |
matrix[e] += 1 | |
} else { |
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
// Vigenère cipher | |
// https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher | |
// Created for a Clash Of Code | |
// doesnt respect case. screw it. | |
function encrypt(text, code) { | |
text = text.toLowerCase(); | |
code = code.toLowerCase(); | |
const alpha = [..."abcdefghijklmnopqrstuvwxyz".repeat(2)]; | |
let output = ""; | |
let key = code; |
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
// Initialize variables | |
const FIRST_PLAYER = 'x' | |
const SECOND_PLAYER = 'o' | |
let currentPlayer = FIRST_PLAYER | |
let running = true | |
let grid = [] | |
startGame() | |
function startGame() { | |
running = true |
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
{ | |
"files.watcherExclude": { | |
"**/.git/objects/**": true, | |
"**/.git/subtree-cache/**": true, | |
"**/node_modules/*/**": true | |
}, | |
"editor.formatOnSave": false, | |
"editor.codeActionsOnSave": { | |
"source.fixAll.eslint": true | |
}, |
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
class ArrayNb extends Array { | |
constructor(props) { | |
!!props ? super(props) : super(); | |
} | |
push(...elements) { | |
if ( [...elements].every(e => typeof e === "number") ){ | |
return super.push(...elements); | |
} else { | |
throw new Error("ArrayNb can only store numbers"); | |
} |
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
function bubbleSort(array) { | |
let res = [...array]; | |
let status = new Array(res.length - 2).fill(false); | |
while (!status.every(e => e === true)) { | |
for (let i = 0; i < res.length - 1; i++) { | |
if (res[i] > res[i + 1]) { | |
// swap values | |
let temp = res[i]; | |
res[i] = res[i + 1]; | |
res[i + 1] = temp; |
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
// Placez vos paramètres dans ce fichier pour remplacer les paramètres par défaut | |
{ | |
// Use ZSH as the integrated terminal shell | |
"terminal.integrated.shell.osx": "zsh", | |
"workbench.colorTheme": "Atom One Dark", | |
"editor.tabSize": 2, | |
"window.zoomLevel": 1, | |
// "sublimeTextKeymap.promptV3Features": true, | |
"gitlens.advanced.messages": { | |
"suppressCommitHasNoPreviousCommitWarning": false, |