Author Topic: Ticketing seat allocation problem  (Read 334 times)

0 Members and 1 Guest are viewing this topic.

Online cfbsoftwareTopic starter

  • Regular Contributor
  • *
  • Posts: 118
  • Country: au
    • Astrobe: Oberon IDE for Cortex-M and FPGA Development
Ticketing seat allocation problem
« on: April 25, 2024, 04:32:25 am »
My partner and i recently attempted to purchase two tickets to a show but the ticket booking software would not allow me to select my preferred seats (N9 and N10 in the attached seating plan)
2140936-0
because that would have left one isolated seat (N11).

In my opinion, while I can accept that it might be desirable to minimise the creation of multiple isolated seats in a row, the application of this rule in this particular scenario is not sensible. It leads to the following consequences:

The seats in row N in the centre section can only be sold in the following circumstances:

1.   A single person can book seat N9 or N11 (but not N10). Then two people like ourselves would be able to book the remaining 2.
2.   A single person can book seat N9 or N11, but then another single person could not book one of the remaining two seats.
3.   Three people can book seats N9, N10 and N11 if they buy them at the same time.

Similarly for rows O and P.

Worse still, nobody can buy eight tickets in row R as that would also leave one isolated seat :wtf:

I suspect that the requirements that were given to the programmer were too simplistic. Given the following definitions:
  • nIsolatedSeats     = the number of empty seats in a row that are not next to an empty seat
  • nOccupiedSeats   = the number of seats in a row that are not empty
  • nRequestedSeats = the number of adjacent seats requested in the current booking. Can't be greater than the number of adjacent empty seats.
  • nEmptySeats       = nOccupiedSeats - nRequestedSeats = the number of empty seats remaining if the current booking is confirmed
The current algorithm appears to be something like:

Code: [Select]
AllocateSeats(nRequestedSeats)
if (nIsolatedSeats > 0) then RejectBooking else ConfirmBooking

My preferred solution that would avoid the questionable situations described above would be:

Code: [Select]
AllocateSeats(nRequestedSeats)
if (nEmptySeats > 1) and (nIsolatedSeats > 0) then RejectBooking else ConfirmBooking

Am I on the right track?
« Last Edit: April 25, 2024, 04:38:16 am by cfbsoftware »
Chris Burrows
CFB Software
https://www.astrobe.com
 

Offline eutectique

  • Frequent Contributor
  • **
  • Posts: 417
  • Country: be
Re: Ticketing seat allocation problem
« Reply #1 on: April 25, 2024, 10:38:39 am »
My preferred solution is
Code: [Select]
AllocateSeats(nRequestedSeats)
TakeMyMoney and ConfirmBooking
 
The following users thanked this post: cfbsoftware


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf