forked from monnerat/web_2025
use constants for rock paper scissors
This commit is contained in:
parent
43b5ee3521
commit
1dcd20de85
@@ -1,9 +1,13 @@
|
||||
<?php
|
||||
$ROCK = 0;
|
||||
$PAPER = 1;
|
||||
$SCISSORS = 2;
|
||||
|
||||
$images = ["rock.png", "paper.png", "scissors.png"];
|
||||
$rules = [
|
||||
0 => [0 => "Draw", 1 => "Loss", 2 => "Win"],
|
||||
1 => [0 => "Win", 1 => "Draw", 2 => "Loss"],
|
||||
2 => [0 => "Loss", 1 => "Win", 2 => "Draw"],
|
||||
$ROCK => [$ROCK => "Draw", $PAPER => "Loss", $SCISSORS => "Win"],
|
||||
$PAPER => [$ROCK => "Win", $PAPER => "Draw", $SCISSORS => "Loss"],
|
||||
$SCISSORS => [$ROCK => "Loss", $PAPER => "Win", $SCISSORS => "Draw"],
|
||||
];
|
||||
|
||||
$playerChoice = filter_input(
|
||||
|
||||
Reference in New Issue
Block a user