<commit_before><?php
/***Rock, Paper, Scissors - by Nxtstep101***/
//Rock = 1
//Paper = 2 
//Scissors = 3
session_start();
$random = rand(1, 3);
$cpu    = $random;
$win    = "Result: You win!";
$loss   = "Result: You lose!";
$tie    = "Result: It's a tie!";
$_SESSION['score'] = ((isset($_SESSION['score'])) ? $_SESSION['score'] : 0);

if (isset($_REQUEST['rock'])) {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $tie;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $loss;
        $_SESSION['score']--;
    } else {
        echo "CPU: Scissors<br/>" . $win;
        $_SESSION['score']++;
    }
} elseif (isset($_REQUEST['paper'])) {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $win;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $tie;
        $_SESSION['score']++;
    } else {
        echo "CPU: Scissors<br/>" . $loss;
        $_SESSION['score']--;
    }
} else {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $loss;
        $_SESSION['score']--;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $win;
        $_SESSION['score']++;
    } else {
        echo "CPU: Scissors<br/>" . $tie;
    }
}
echo $_SESSION['score'];
?>
<!DOCTYPE html>
<html>
  <body>
    <form action="game.php" method="post">
      <input type="submit" name="rock" value="rock">
      <input type="submit" name="paper" value="paper">
      <input type="submit" name="scissors" value="scissors">
    </form>
  </body>
</html><commit_msg>Allowing player to clear session data<commit_after><?php
/***Rock, Paper, Scissors - by Nxtstep101***/
//Rock = 1
//Paper = 2 
//Scissors = 3
session_start();
$random = rand(1, 3);
$cpu    = $random;
$win    = "Result: You win!";
$loss   = "Result: You lose!";
$tie    = "Result: It's a tie!";
$_SESSION['score'] = ((isset($_SESSION['score'])) ? $_SESSION['score'] : 0);

if (isset($_REQUEST['rock'])) {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $tie;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $loss;
        $_SESSION['score']--;
    } else {
        echo "CPU: Scissors<br/>" . $win;
        $_SESSION['score']++;
    }
} elseif (isset($_REQUEST['paper'])) {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $win;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $tie;
        $_SESSION['score']++;
    } else {
        echo "CPU: Scissors<br/>" . $loss;
        $_SESSION['score']--;
    }
} elseif (isset($_REQUEST['scissors'])) {
    if ($cpu === 1) {
        echo "CPU: Rock<br/>" . $loss;
        $_SESSION['score']--;
    } elseif ($cpu === 2) {
        echo "CPU: Paper<br/>" . $win;
        $_SESSION['score']++;
    } else {
        echo "CPU: Scissors<br/>" . $tie;
    }
} elseif (isset($_REQUEST['restart'])) {
    session_unset();
}
echo "<br />Score: " . $_SESSION['score'];
?>
<!DOCTYPE html>
<html>
  <body>
    <form action="game.php" method="post">
      <input type="submit" name="rock" value="rock">
      <input type="submit" name="paper" value="paper">
      <input type="submit" name="scissors" value="scissors">
      <input type="submit" name="restart" value="restart">
    </form>
  </body>
</html>
{'fraction_non_alphanumeric': 0.24016497461928935, 'fraction_numerical': 0.00951776649746193, 'mean_word_length': 2.566742081447964, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '621967', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1115, 'n_words': 268}