예제 #1
0
  function xyToSeat($x, $y)
  {
    $seatNum = xyToSeatType($x, $y);
    if ($seatNum >= 0)
    {
      return $seatNum;
    }

    if ($x <= -27)
    {
      return $x + 50;
    }
    
    if ($x >= -25 && $x <= -1)
    {
      return $x + 26;
    }

    if ($x >= 1 && $x <= 21)
    {
      return $x;
    }

    if ($x >= 23 && $x <= 43)
    {
      return $x - 22;
    }
  
    if ($x >= 45 && $x <= 65)
    {
      return $x - 44;
    }
   
    if ($x >= 67 && $x <= 91)
    {
      return $x - 66;
    }

    if ($x >= 93)
    {
      return $x - 92;
    }
  }
 function xyToTicketType($x, $y)
 {
   ECHO "[$x, $y]";
   $SeatType = xyToSeatType($x, $y);
   if ($SeatType == 0)
   { ECHO "STAIRS<BR>";
     return array(5, 1); // Stairs, closed
   }
   if ($SeatType == -1)
   {ECHO "GENERAL<BR>";
     return array(3, 2); // General Addmission, available
   }
   if ($SeatType == -2)
   { ECHO "BLAST<BR>";
     return array(4, 2); // Blast Zone, available
   }
   if ($SeatType == -3)
   { ECHO "PRESS<BR>";
     return array(6, 1); // Pressbox, closed
   }
   
   if ($x <= 16 || $x >= 50)
   { ECHO "RESERVE<BR>";
     return array(2, 2); // Reserved, available
   }
   else
   { ECHO "PREMIUM<BR>";
     return array(1,2); // Premium, available
   }
 }