Skip to content

Instantly share code, notes, and snippets.

@moonspam
Last active January 8, 2018 09:22
Show Gist options
  • Save moonspam/42f33b4a8f7bd460c50d6c96f3521a29 to your computer and use it in GitHub Desktop.
Save moonspam/42f33b4a8f7bd460c50d6c96f3521a29 to your computer and use it in GitHub Desktop.
점심뭐먹지? v1.0
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>점심 뭐 먹지?</title>
</head>
<body>
<?php
// 확률함수
function gachaLunch($min,$max=100) {
return(mt_rand(1,$max)<=$min);
}
if($_GET['s'] == 'actoz') {
// 음식점 정보
$store1 = array('고리','bg','www','123');
$store2 = array('교동짬뽕','bg','www','123');
$store3 = array('김치찌개','bg','www','123');
$store4 = array('남미식당','bg','www','123');
$store5 = array('돌냄비김치찜','bg','www','123');
$store6 = array('맥도날드','bg','www','123'); //20%
$store7 = array('부대찌게','bg','www','123'); //20%
$store8 = array('삼미기사식당','bg','www','123');
$store9 = array('수제비','bg','www','123');
$store10 = array('쌀국수','bg','www','123');
$store11 = array('영주고기','bg','www','123');
$store12 = array('작은가게','bg','www','123'); //5%
$store13 = array('종로김밥','bg','www','123'); //5%
$store14 = array('진짜 설렁탕','bg','www','123'); //5%
$store15 = array('찰스김밥','bg','www','123'); //5%
$store16 = array('콩나물국밥','bg','www','123');
$store17 = array('한우마당','bg','www','123');
$store18 = array('황톳길','bg','www','123');
$store19 = array('LG건물 아워홈','bg','www','123'); //20%
$store20 = array('25가츠','bg','www','123'); //20%
// 확률설정 7.5:2:0.5
if(gachaLunch(20)) {
$getLunch = array($store6,$store7,$store19,$store20);
}
if(gachaLunch(5)) {
$getLunch = array($store12,$store13,$store14,$store15);
}
else {
$getLunch = array($store1,$store2,$store3,$store4,$store5,$store8,$store9,$store10,$store11,$store16,$store17,$store18);
}
// 결과 랜덤
$answer = $getLunch[mt_rand(0, count($getLunch) - 1)];
} else {
$answer[0] = '준비중입니다.';
}
?>
<div class="box">
<h1>(ㅇ_ ㅇ)a<br>
<i>점심 뭐 먹지잉?</i></h1>
<h1 class="answer"><?php echo $answer[0]; ?></h1>
<img src="svg/location.svg" width="32" height="32" alt="위치" title="위치">&nbsp;&nbsp;&nbsp;&nbsp;<img src="svg/phone.svg" width="32" height="32" alt="전화번호" title="전화번호">&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onClick="window.location.reload(true);"><img src="svg/refresh.svg" width="32" height="32" alt="새로고침" title="새로고침"></a>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment