boris: Tennis

Beitrag lesen

da kommen wir der sache wohl schon etwas näher...

<?php

echo "<h2>Tennis</h2>";

$points_player1a = array("0","15","30","40","ADV");
$points_player2a = array("0","15","30","40","ADV");
$points_player1 = array();
$points_player2 = array();

echo "0:0<br>";

$points_player1[] = $points_player1a[0];
$points_player2[] = $points_player2a[0];

$max_games = 1;
for ($i = 1; $i <= $max_games; $i++) {

$zufall = rand(1,2);
if ($zufall == "1") { $points_player1[] = next($points_player1a); } else { $points_player2[] = next($points_player2a); }

echo end($points_player1).":".end($points_player2)."<br>";

if ((end($points_player1) != "40") AND (end($points_player2) != "40")) {
$max_games++;
}

}