Add dice PHP exercise.
This commit is contained in:
parent
55ee7e36f9
commit
0c0702fc77
26
2/IAW/exercises/php/dice.php
Normal file
26
2/IAW/exercises/php/dice.php
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Dice</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$num_dice = rand(1,10);
|
||||
?>
|
||||
<h1><?= $num_dice ?> dados</h1>
|
||||
<?php
|
||||
$rolls = [];
|
||||
$max = -1;
|
||||
for($i = 0; $i < $num_dice; $i++) {
|
||||
$rolls[$i] = rand(1,6);
|
||||
if($rolls[$i] > $max)
|
||||
$max = $rolls[$i];
|
||||
?>
|
||||
<img src="imgs/<?= $rolls[$i] ?>.svg" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<p>El valor más grande obtenido es <b><?= $max ?></b>.</p>
|
||||
<p>Última modificación de esta página: <?= date('Y-m-d', filemtime(__FILE__)) ?>
|
||||
</body>
|
||||
</html>
|
8
2/IAW/exercises/php/imgs/1.svg
Normal file
8
2/IAW/exercises/php/imgs/1.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="60" cy="62" r="9" fill="white" />
|
||||
<circle cx="60" cy="60" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 382 B |
11
2/IAW/exercises/php/imgs/2.svg
Normal file
11
2/IAW/exercises/php/imgs/2.svg
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="30" cy="32" r="9" fill="white" />
|
||||
<circle cx="30" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="92" r="9" fill="white" />
|
||||
<circle cx="90" cy="90" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 479 B |
14
2/IAW/exercises/php/imgs/3.svg
Normal file
14
2/IAW/exercises/php/imgs/3.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="30" cy="32" r="9" fill="white" />
|
||||
<circle cx="30" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="60" cy="62" r="9" fill="white" />
|
||||
<circle cx="60" cy="60" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="92" r="9" fill="white" />
|
||||
<circle cx="90" cy="90" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 576 B |
17
2/IAW/exercises/php/imgs/4.svg
Normal file
17
2/IAW/exercises/php/imgs/4.svg
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="30" cy="32" r="9" fill="white" />
|
||||
<circle cx="30" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="30" cy="92" r="9" fill="white" />
|
||||
<circle cx="30" cy="90" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="32" r="9" fill="white" />
|
||||
<circle cx="90" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="92" r="9" fill="white" />
|
||||
<circle cx="90" cy="90" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 673 B |
20
2/IAW/exercises/php/imgs/5.svg
Normal file
20
2/IAW/exercises/php/imgs/5.svg
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="30" cy="32" r="9" fill="white" />
|
||||
<circle cx="30" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="30" cy="92" r="9" fill="white" />
|
||||
<circle cx="30" cy="90" r="9" fill="black" />
|
||||
|
||||
<circle cx="60" cy="62" r="9" fill="white" />
|
||||
<circle cx="60" cy="60" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="32" r="9" fill="white" />
|
||||
<circle cx="90" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="92" r="9" fill="white" />
|
||||
<circle cx="90" cy="90" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 770 B |
23
2/IAW/exercises/php/imgs/6.svg
Normal file
23
2/IAW/exercises/php/imgs/6.svg
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="140" height="140" viewBox="-10 -10 140 140">
|
||||
<rect x="0" y="0" width="120" height="120" rx="10" ry="10"
|
||||
fill="#E0E0E0" stroke="black" stroke-width="5" />
|
||||
<circle cx="30" cy="32" r="9" fill="white" />
|
||||
<circle cx="30" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="30" cy="62" r="9" fill="white" />
|
||||
<circle cx="30" cy="60" r="9" fill="black" />
|
||||
|
||||
<circle cx="30" cy="92" r="9" fill="white" />
|
||||
<circle cx="30" cy="90" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="32" r="9" fill="white" />
|
||||
<circle cx="90" cy="30" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="62" r="9" fill="white" />
|
||||
<circle cx="90" cy="60" r="9" fill="black" />
|
||||
|
||||
<circle cx="90" cy="92" r="9" fill="white" />
|
||||
<circle cx="90" cy="90" r="9" fill="black" />
|
||||
</svg>
|
After Width: | Height: | Size: 867 B |
Loading…
Reference in New Issue
Block a user