CoddityTeam / movaicode

Concours mensuel du Pire Développeur de France
123 stars 10 forks source link

JS / Renverser la ficelle #7

Closed AxelDelcros closed 2 years ago

AxelDelcros commented 4 years ago

Mode d'emploi : Renverser la ficelle

Prérequis pour pouvoir renverser la ficelle

function renverserLaFicelle(ficelle) {
  var Copie_De_La_Ficelle = "";
  for (var i = 0; typeof ficelle[i] != "undefined"; i = i + 1) {
    Copie_De_La_Ficelle = Copie_De_La_Ficelle.concat(ficelle[i]);
  }

  var Ficelle_Finale = "";
  while (typeof Copie_De_La_Ficelle != "undefined") {
    var j = 0;
    while (typeof Copie_De_La_Ficelle[j + 1] != "undefined") {
      j = j + 1;
    }
    if (Copie_De_La_Ficelle[j]) {
      Ficelle_Finale = Ficelle_Finale.concat(Copie_De_La_Ficelle[j]);
      Copie_De_La_Ficelle = Copie_De_La_Ficelle.substring(0, j);
      if (Copie_De_La_Ficelle == "") {
        Copie_De_La_Ficelle = undefined;
      }
    }
  }

  delete Copie_De_La_Ficelle;
  return Ficelle_Finale;
}

console.log(renverserLaFicelle(process.argv[2]));

Comment renverser la ficelle

Il suffit de taper la ligne qui suit en remplaçant par la ficelle que vous souhaitez renverser.

node renverserLaFicelle.js "<votre ficelle ici>"

puis appuyer sur la touche Entrée de votre clavier.

Quelques exemples d'utilisation

    node renverserLaFicelle.js "udrep ia'J"

    -> "J'ai perdu"
    node renverserLaFicelle.js "redruM"

    -> "Murder"
    node renverserLaFicelle.js "daed si luaP"

    -> "Paul is dead"

Amusez-vous bien à renverser la ficelle !

mehdi-dalil commented 4 years ago

j'ai perdu !

louismarslen commented 3 years ago

Cher Axel, j'ai le plaisir et l'honneur de t'annoncer que tu n'as PAS gagné le concours MOVAI CODE. Ce qui fait de toi un EKSSELAN Codeur.

SPOILER : j'espère qu'on aura le plaisir de recevoir ta participation à l'episode 2 du MOVAI CODE (stay tuned).

Bravo toutefois pour ta belle contribution 😊

louismarslen commented 2 years ago

Je fais un peu de ménage dans les issues -> d'ailleurs go participer à l'édition 5