EEVblog® Electronics Community Forum

Products => Computers => Programming => Topic started by: cfbsoftware on April 25, 2024, 04:32:25 am

Title: Ticketing seat allocation problem
Post by: cfbsoftware 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)
[attach=1]
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:
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?
Title: Re: Ticketing seat allocation problem
Post by: eutectique on April 25, 2024, 10:38:39 am
My preferred solution is
Code: [Select]
AllocateSeats(nRequestedSeats)
TakeMyMoney and ConfirmBooking