196 lines
5.3 KiB
HTML
196 lines
5.3 KiB
HTML
|
<html>
|
||
|
<style>
|
||
|
div#szinhazterem {
|
||
|
max-width: 620px;
|
||
|
margin: 0 auto;
|
||
|
}
|
||
|
|
||
|
span.helyar {
|
||
|
display: inline-block;
|
||
|
float: right;
|
||
|
margin: 40px -24px 0 0;
|
||
|
width: 128px;
|
||
|
height: 60px;
|
||
|
line-height: 60px;
|
||
|
background-color: #AAF;
|
||
|
text-align: center;
|
||
|
font-size: 16px;
|
||
|
font-weight: bold;
|
||
|
transform: rotate(-90deg);
|
||
|
}
|
||
|
|
||
|
span.sorszam {
|
||
|
display: inline-block;
|
||
|
width: 24px;
|
||
|
height: 14px;
|
||
|
margin-right: 8px;
|
||
|
text-align: right;
|
||
|
}
|
||
|
|
||
|
span.szek {
|
||
|
display: inline-block;
|
||
|
margin: 6px 2px;
|
||
|
width: 14px;
|
||
|
height: 14px;
|
||
|
border-radius: 2px;
|
||
|
text-align: center;
|
||
|
line-height: 14px;
|
||
|
font-size: 9px;
|
||
|
color: #333;
|
||
|
}
|
||
|
|
||
|
span.foglalt {
|
||
|
border: solid 1px #844;
|
||
|
background-color: #FAA;
|
||
|
color: #600;
|
||
|
}
|
||
|
|
||
|
span.szabad {
|
||
|
border: solid 1px #484;
|
||
|
background-color: #8D8;
|
||
|
color: #040;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<div id='szinhazterem'>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
hely = new Array()
|
||
|
szabad = 0;
|
||
|
össz = 0;
|
||
|
kat1 = 0;
|
||
|
kat2 = 0;
|
||
|
kat3 = 0;
|
||
|
vanolyansor = "Nincs ";
|
||
|
legalabb4szabad = "Nincs "
|
||
|
hanypar = 0;
|
||
|
sor8 = 0;
|
||
|
hely8 = 0;
|
||
|
for (i = 1; i <= 15; i++) {
|
||
|
if (i == 1) document.write("<span class='helyar'>7500.- Ft</span>")
|
||
|
if (i == 6) document.write("<span class='helyar'>5900.- Ft</span>")
|
||
|
if (i == 11) document.write("<span class='helyar'>4500.- Ft</span>")
|
||
|
|
||
|
hely[i] = new Array()
|
||
|
document.write("<span class='sorszam'>" + i + ".</span>")
|
||
|
for (j = 1; j <= 24; j++) {
|
||
|
hely[i][j] = Math.floor((1 - Math.random() * Math.random()) * 2)
|
||
|
if (hely[i][j] == 1) {
|
||
|
document.write("<span class='szek foglalt' title='hely[" + i + "][" + j + "] = " + hely[i][j] + "'>" + j + "</span>")
|
||
|
}
|
||
|
else {
|
||
|
document.write("<span class='szek szabad' title='hely[" + i + "][" + j + "] = " + hely[i][j] + "'>" + j + "</span>")
|
||
|
}
|
||
|
}
|
||
|
document.write("<br>")
|
||
|
if (i % 5 == 0) document.write("<hr size=1 color=#880000>")
|
||
|
}
|
||
|
const csorohely = []
|
||
|
|
||
|
for (i = 1; i < hely.length; i++) {
|
||
|
nemlehetsorfoglalt = false;
|
||
|
negylegalabb = 0;
|
||
|
parok = 0;
|
||
|
for (let z = 1; z < hely[i].length; z++) {
|
||
|
if (hely[i][z] == 0) {
|
||
|
if (z == 1 || z == 24) {
|
||
|
if (i > sor8) {
|
||
|
sor8 = i;
|
||
|
hely8 = z;
|
||
|
}
|
||
|
csorohely.push(i + ";" + z)
|
||
|
|
||
|
}
|
||
|
szabad++;
|
||
|
negylegalabb++;
|
||
|
parok++;
|
||
|
nemlehetsorfoglalt = true;
|
||
|
if (negylegalabb > 3) {
|
||
|
legalabb4szabad = "Van";
|
||
|
}
|
||
|
if (parok = 2) {
|
||
|
hanypar++;
|
||
|
}
|
||
|
} else {
|
||
|
parok = 0;
|
||
|
negylegalabb = 0;
|
||
|
if (i < 6) kat1++;
|
||
|
if ((6 <= i) && (i < 11)) kat2++;
|
||
|
if (i > 11) kat3++;
|
||
|
}
|
||
|
össz++;
|
||
|
}
|
||
|
if (nemlehetsorfoglalt == false) {
|
||
|
vanolyansor = "Van" + "(" + i + ")";
|
||
|
}
|
||
|
}
|
||
|
kat = { I: kat1, II: kat2, III: kat3 };
|
||
|
var max = 0;
|
||
|
var maxkat = "";
|
||
|
for (var key in kat) {
|
||
|
var value = kat[key];
|
||
|
if (value > max) {
|
||
|
max = value
|
||
|
maxkat = key;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
let van = false;
|
||
|
for (let i = 11; i <= 15; i++) {
|
||
|
for (let x = 0; x < csorohely.length; x++) {
|
||
|
if(i == csorohely[x].split(";")[0]){
|
||
|
van = true
|
||
|
sor8 = csorohely[x].split(";")[0]
|
||
|
hely8 = csorohely[x].split(";")[1]
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if (van === true) {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if(van === false)
|
||
|
{
|
||
|
for (let i = 6; i <= 10; i++) {
|
||
|
for (let x = 0; x < csorohely.length; x++) {
|
||
|
if(i == csorohely[x].split(";")[0]){
|
||
|
van = true
|
||
|
sor8 = csorohely[x].split(";")[0]
|
||
|
hely8 = csorohely[x].split(";")[1]
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if (van === true) {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (van === false) {
|
||
|
for (let i = 1; i <= 5; i++) {
|
||
|
for (let x = 0; x < csorohely.length; x++) {
|
||
|
if(i == csorohely[x].split(";")[0]){
|
||
|
van = true
|
||
|
sor8 = csorohely[x].split(";")[0]
|
||
|
hely8 = csorohely[x].split(";")[1]
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
if (van === true) {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
document.write("<p>1. szabad : " + szabad + "<p>");
|
||
|
document.write("<p>2. százalék : " + (100 - ((100 * (kat1 + kat2 + kat3)) / össz)).toFixed(0) + "%<p>");
|
||
|
document.write("<p>3. Bevétel : " + ((kat1 * 7500) + (kat2 * 5900) + (kat3 * 4500)) + " Ft <p>");
|
||
|
document.write("<p>4. Legtöbb eladás kategóriában : " + maxkat + ". Zóna <p>");
|
||
|
document.write("<p>5. Tele sor : " + vanolyansor + "<p>");
|
||
|
document.write("<p>6. 4 üres hely egymás mellett : " + legalabb4szabad + "<p>");
|
||
|
document.write("<p>7. Posszibilis ülőhely pároknak : " + hanypar + "db <p>");
|
||
|
document.write("<p>8. Olcsó de elöl ül : sor: " + sor8 + " hely: " + hely8 + " <p>");
|
||
|
</script>
|
||
|
|
||
|
</div>
|
||
|
</html>
|