Actividad de programación para estudiantes de secundaria canadienses: Modelar una reserva de asientos en papel.

butacas rojas vacías de teatro en fila

Two groups arrive at a school play and both expect to sit in A3. On the mock booking chart, the seat was marked open both times even after one group had reserved it. What went wrong? This Canadian middle-school coding activity uses paper to show how a small program keeps track of changing information. Pupils will write rules for reserving and releasing seats, then test the order in which those rules are applied. No live bookings, names or computers are needed.

In Revista para profesores canadienses, Robert Attwell describes visiting a secondary school in the Coquitlam School District in British Columbia and watching pupils develop a simulation of business decisions. The activity below uses the same broad idea of modelling a familiar situation, but the fictional school play and its booking rules are original.

Represent what is true before anyone asks for a seat

Draw two rows of four squares. Label the seats A1 to A4 and B1 to B4, and put an O for open in each square. A seat can have only one status at a time in this model: open or reserved. Use R for reserved. Write the meaning of each symbol beside the chart. The state is the set of seat statuses right now. It is not the same thing as the list of all requests that have been made.

On slips of paper, write “reserve A3”, “reserve B1”, “reserve A3” and “release A3”. One partner reads the slips and the other acts as the program. Process one slip completely before looking at the next one. Agree not to guess what the next request will be, and do not put real pupils’ names or contact details on the chart.

Write a rule for each request and each status

If a request says reserve and the seat is open, change it to reserved and write “accepted”. If the seat is already reserved, leave the chart as it is and write “not available”. If the request says release and the seat is reserved, change it to open. A request to release an open seat should leave the chart unchanged and return “already open”. These simple messages help a partner check that the rule did what they expected.

Follow the four slips in order. A3 changes to reserved, then B1 changes to reserved. The repeated request for A3 does not change the chart. The final slip opens A3, leaving only B1 reserved. Ask the partner running the chart to point out which instruction was rejected and why. It is not rejected just because A3 appears twice in a list. It is rejected because A3 is already reserved at the moment of that request.

Reorder the requests and see what changes

Reset every seat to open. Move the release slip so it comes right before the second request to reserve A3. Now that second request can be accepted, and two seats are reserved at the end. The slips are the same, but their order changes the final state. Record the expected result before each run so you can tell whether the difference came from your design or from a mistake while following it.

For a final test, add the slip “reserve C9”. No such seat exists in this model. Decide how to handle that request before processing it: check that the label exists and report an unknown seat without changing any existing status. Then give the chart and rules to someone who did not write them. If they can test valid, repeated and unknown requests without needing hints, your paper program is clear enough to explain. For a real performance, use the school’s booking process; this exercise only models how a rule changes a record.

As one more check, add a second release of A3 immediately after the first. The final chart should not change again, but the reply should now say that the seat is already open.

Compartir:

Artículos Relacionados

¡Chatea con nosotros por WhatsApp!