#what is wrong with my rock paper scissor logic

14 messages ยท Page 1 of 1 (latest)

spice venture
#

client.on('message', async msg => {

if (['โœŠ','๐Ÿ–๏ธ','โœŒ๏ธ'].includes(msg.body)) {
    
    const RPS = () => {
        const emojis = ['โœŠ','๐Ÿ–๏ธ','โœŒ๏ธ'];
        const random = Math.floor(Math.random() * 3);
        return emojis[random];
    };

    const emoji = RPS();
    const beats = {['โœŠ']:'โœŒ๏ธ', ['๐Ÿ–๏ธ']:'โœŠ', ['โœŒ๏ธ']:'๐Ÿ–๏ธ'};
    msg.reply(emoji);

    if(msg.body === emoji) {
        client.sendMessage(msg.from,"It's a draw ๐Ÿ˜‘");
    } else if (beats[msg.body] === emoji) {
        client.sendMessage(msg.from,'You won ๐Ÿคฏ');
    } else {
        client.sendMessage(msg.from,'You lost ๐Ÿ˜‚');
    }
}

});

user rock interactions r working fine, but user's paper and scissor r always losing against me regardless of my generated emoji

#

current interactions
msg.body : emoji : result

rock : scissor : you win
rock : paper : you lose
rock : rock : its a draw
paper/scissor : rock/paper/scissor : you lose

fleet saffron
#
client.on('message', async msg => {

    if ([':fist:',':hand_splayed:',':v:'].includes(msg.body)) 

    const beats = {['โœŠ']:'โœŒ๏ธ', ['๐Ÿ–๏ธ']:'โœŠ', ['โœŒ๏ธ']:'๐Ÿ–๏ธ'};

});

this part works fine?

spice venture
fleet saffron
#

i would do that alone

#

just to see if it works

spice venture
fleet saffron
#

i used include that way

#

the way u used i tried a long time ago but it didnt work

spice venture
#

oh

fleet saffron
#

idk if the include can read all the [] one by one

spice venture
#

how do i close this post (its resolved)

candid tulip