avatar
Untitled

Guest 45 15th Jan, 2020

MARKUP 6.52 KB
                                           
                         <?php
$bingo = array();
for ($i=0; $i<5; $i++) {
	$numbers = range($i*15+1, $i*15+15);
	shuffle($numbers);
	$bingo[$i] = array_slice($numbers, 0, 5);
}
$s = "";
for ($j=0; $j<5; $j++){
	$s .= "<tr>";
	for ($k=0; $k<5; $k++){
		$s .= ($j==2 && $k==2)? "<td></td>": sprintf("<td>%s</td>",$bingo[$k][$j]);
	}
	$s .= "</tr>";
}
?>

<!DOCTYPE html>
<html lang="ja">
<head>
	<meta charset="UTF-8" />
	<title>BINGO</title>
</head>
<style>
	td, th {
		 /* font-size: 60px; */
		width: 50px; /* 120px */
		border: 1px solid #ccc;
		text-align: center;
	}
</style>
<body>
	<!-- <p><input type="button" id="getResult" value="次のボール"></p>
	<p id="result"></p> -->
	<button>Start</button>
	<div id="number"></div>
	<h1>Result</h1>
	<div id="result"></div>
<?php

$b1 = 1;
$b2 = 2;
$b3 = 3;
$b4 = 4;
$b5 = 5;
$b6 = 6;
$b7 = 7;
$b8 = 8;
$b9 = 9;
$b10 = 10;
$b11 = 11;
$b12 = 12;
$b13 = 13;
$b14 = 14;
$b15 = 15;

$i16 = 16;
$i17 = 17;
$i18 = 18;
$i19 = 19;
$i20 = 20;
$i21 = 21;
$i22 = 22;
$i23 = 23;
$i24 = 24;
$i25 = 25;
$i26 = 26;
$i27 = 27;
$i28 = 28;
$i29 = 29;
$i30 = 30;

$n31 = 31;
$n32 = 32;
$n33 = 33;
$n34 = 34;
$n35 = 35;
$n36 = 36;
$n37 = 37;
$n38 = 38;
$n39 = 39;
$n40 = 40;
$n41 = 41;
$n42 = 42;
$n43 = 43;
$n44 = 44;
$n45 = 45;

$g46 = 46;
$g47 = 47;
$g48 = 48;
$g49 = 49;
$g50 = 50;
$g51 = 51;
$g52 = 52;
$g53 = 53;
$g54 = 54;
$g55 = 55;
$g56 = 56;
$g57 = 57;
$g58 = 58;
$g59 = 59;
$g60 = 60;

$o61 = 61;
$o62 = 62;
$o63 = 63;
$o64 = 64;
$o65 = 65;
$o66 = 66;
$o67 = 67;
$o68 = 68;
$o69 = 69;
$o70 = 70;
$o71 = 71;
$o72 = 72;
$o73 = 73;
$o74 = 74;
$o75 = 75;

echo "
	<table>
	<tr>
		<th>B</th>
		<th>I</th>
		<th>N</th>
		<th>G</th>
		<th>O</th>
	</tr>
	<tr>
		<td>$b1</td>
		<td>$i16</td>
		<td>$n31</td>
		<td>$g46</td>
		<td>$o61</td>
	</tr>
	<tr>
		<td>$b2</td>
		<td>$i17</td>
		<td>$n32</td>
		<td>$g47</td>
		<td>$o62</td>
	</tr>
	<tr>
		<td>$b3</td>
		<td>$i18</td>
		<td>$n33</td>
		<td>$g48</td>
		<td>$o63</td>
	</tr>
	<tr>
		<td>$b4</td>
		<td>$i19</td>
		<td>$n34</td>
		<td>$g49</td>
		<td>$o64</td>
	</tr>
	<tr>
		<td>$b5</td>
		<td>$i20</td>
		<td>$n35</td>
		<td>$g50</td>
		<td>$o65</td>
	</tr>
	<tr>
		<td>$b6</td>
		<td>$i21</td>
		<td>$n36</td>
		<td>$g51</td>
		<td>$o66</td>
	</tr>
	<tr>
		<td>$b7</td>
		<td>$i22</td>
		<td>$n37</td>
		<td>$g52</td>
		<td>$o67</td>
	</tr>
	<tr>
		<td>$b8</td>
		<td>$i23</td>
		<td>$n38</td>
		<td>$g53</td>
		<td>$o68</td>
	</tr>
	<tr>
		<td>$b9</td>
		<td>$i24</td>
		<td>$n39</td>
		<td>$g54</td>
		<td>$o69</td>
	</tr>
	<tr>
		<td>$b10</td>
		<td>$i25</td>
		<td>$n40</td>
		<td>$g55</td>
		<td>$o70</td>
	</tr>
	<tr>
		<td>$b11</td>
		<td>$i26</td>
		<td>$n41</td>
		<td>$g56</td>
		<td>$o71</td>
	</tr>
	<tr>
		<td>$b12</td>
		<td>$i27</td>
		<td>$n42</td>
		<td>$g57</td>
		<td>$o72</td>
	</tr>
	<tr>
		<td>$b13</td>
		<td>$i28</td>
		<td>$n43</td>
		<td>$g58</td>
		<td>$o73</td>
	</tr>
	<tr>
		<td>$b14</td>
		<td>$i29</td>
		<td>$n44</td>
		<td>$g59</td>
		<td>$o74</td>
	</tr>
	<tr>
		<td>$b15</td>
		<td>$i30</td>
		<td>$n45</td>
		<td>$g60</td>
		<td>$o75</td>
	</tr>
	</table>
	";


?>
	<table>
		<div id="sheet">
			<?php echo "<br><br><br><br><br><br><br><br><br><br><br><br>", $s;
			//$eachData = print_r(array_chunk($bingo,1));
			//var_dump($eachData);
			// print_r(array_chunk($bingo,1));
			// var_dump(array[0,0,2]):
			?>
		</div>
	</table>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
		//  $(function(){
		//  	$("#getResult").click(function(){
		//  		var num = Math.floor(Math.random()*75);
		//  		var result = num;
		//  		$("#result").text(result);
		//  		$("#sheet").css("color","red");
		//  		$("td").find().css("color","red");
		//  	});
		// });
$(function(){
	max = 50;
	bingo = new Array();
	for(i = 1; i <= max; i++) {
		bingo.push(i);
	}
	status = 0;
	$("button").click(function(){
		if(status == 0) {
			status = 1;
			$("button").text("Stop");
			roulette = setInterval(function(){
				random = Math.floor(Math.random() * bingo.length);
				number = bingo[random];
				$("#number").text(number);
			}, 75);
		} else {
			status = 0;
			$("button").text("Start");
			clearInterval(roulette);
			random = Math.floor(Math.random() * bingo.length);
			result = bingo[random];
			bingo.splice(random, 1);
			$("#number").text(result);
			$("#result").append(result + ", ");
		}
	});
});
</script>


</body>
</html>
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes