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