Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <section class="flex flex-col justify-between h-screen">
        <section class="w-screen p-8 text-center">
        <h2 class="text-indigo-800 text-2xl font-bold"><span class="text-red-800">Malandriner plays!</span></h2>

        <div class="flex justify-center">
          <button id="rock" class="bg-blue-200 p-4 m-4 rounded-sm text-3xl">Rock โœŠ</button>
          <button id="paper" class="bg-red-200 p-4 m-4 rounded-sm text-3xl">Paper โœ‹</button>
          <button id="scissors" class="bg-indigo-200 p-4 m-4 rounded-sm text-3xl">Scissors โœŒ</button>
          <button id="lizard" class="bg-green-200 p-4 m-4 rounded-sm text-3xl">Lizard ๐ŸฆŽ</button>
          <button id="spock" class="bg-purple-200 p-4 m-4 rounded-sm text-3xl">Spock ๐Ÿ––</button>
        <div class="text-center bg-green-300 p-8 text-2xl hidden" id="score" >
        <div id="js-score-board" class="justify-between p-6 bg-pink-800 text-yellow-200 text-3xl hidden">
          <div class="flex">
            <div id="elvis">๐Ÿ•บ</div> <div id="player">0</div>
            ๐Ÿค <span id="draw">0</span>
            ๐Ÿ’ป <span id="computer">0</span>
  <footer class="bg-purple-800 text-white p-4 text-right">Programado en directo en <a href="" target="_blank" class="underline"></a></footer>




                // Elaborado en un Mob Programming en directo en

const buttons = document.querySelectorAll('button');

const scoreBoard = {
  player: 0,
  computer: 0,
  draw: 0

const rules = {
  rock: { wins: ["scissors", "lizard"] },
  scissors: { wins: ["paper", "lizard"] },
  paper: { wins: ["rock", "spock"] },
  lizard: { wins: ["paper", "spock"] },
  spock: { wins: ["rock", "scissors"] },

const computerBet = () => {
  const options = ['rock', 'paper', 'scissors', 'lizard', 'spock'];
  const index = Math.floor(Math.random() * options.length);
  return options[index];

const whoWins = (player, computer) => {
  if(player === computer) {
    return 'draw';

  if(rules[player].wins.includes(computer)) {
    return 'player';

  return 'computer';

const printScoreMessage = (player, computer, winner) => {
  const score = document.getElementById("score");
  score.innerHTML = `Player: ${player} ยท Computer: ${computer} โžก๏ธ <strong>${
    winner === "draw" ? "draw" : winner + " wins!"

const printScoreBoard = (scoreBoard) => {
  const scoreBoardElem = document.getElementById("js-score-board");
  for(const item in scoreBoard) {
    document.getElementById(item).innerHTML = scoreBoard[item];

const animateElvis = () => {
    .animate([{ transform: "scale(1, -1)" }], {
      duration: 500,
      iterations: 2,

const play = (e) => {
  const playerBet =;
  const computer = computerBet();
  const winner = whoWins(playerBet, computer);

  if(winner === 'player') {

  printScoreMessage(playerBet, computer, winner);

for (let i = 0; i < buttons.length; i++) {
  buttons[i].addEventListener('click', play)