Ad
Code
Diff
  • awan_world=lambda _:f"{['Goodbye','awan'][_]}, World"
    • hello_world=lambda _:f"{['Goodbye','Hello'][_]}, World"
    • awan_world=lambda _:f"{['Goodbye','awan'][_]}, World"
Code
Diff
  • function rps(player1, player2) {
        if (player1 === player2) {
            return 'Draw!';
        } else if (
            (player1 === 'rock' && player2 === 'scissors') ||
            (player1 === 'scissors' && player2 === 'paper') ||
            (player1 === 'paper' && player2 === 'rock')
        ) {
            return 'Player 1 won!';
        } else {pp
            return 'Player 2 won!';
        }
    }
    
    • function rps(player1, player2) {
    • if (player1 === player2) {
    • return 'Draw!';
    • } else if (
    • (player1 === 'rock' && player2 === 'scissors') ||
    • (player1 === 'scissors' && player2 === 'paper') ||
    • (player1 === 'paper' && player2 === 'rock')
    • ) {
    • return 'Player 1 won!';
    • } else {
    • } else {pp
    • return 'Player 2 won!';
    • }
    • }
// Create a canvas element

const canvas = document.createElement('canvas');

const ctx = canvas.getContext('2d');

document.body.appendChild(canvas);

// Set canvas size

canvas.width = window.innerWidth;

canvas.height = window.innerHeight;

// Car object

const car = {

  x: 50,

  y: canvas.height / 2,

  width: 100,

  height: 50,

  speed: 5,

  draw: function() {

    ctx.fillStyle = 'blue';

    ctx.fillRect(this.x, this.y, this.width, this.height);

  },

  update: function() {

    this.x += this.speed;

    if (this.x > canvas.width) {

      this.x = -this.width;

    }

  }

};

// Animation loop

function animate() {

  ctx.clearRect(0, 0, canvas.width, canvas.height);

  car.draw();

  car.update();

  requestAnimationFrame(animate);

}

// Start the animation

animate();