Python Forum
Help with list homework
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with list homework
#6
The rules, as stated in the original post, are wrong. I think these are the rules
0 is an empty seat
You can only sit in an empty seat
1 cannot sit next to 1 or 2
2 cannot sit next to 1

I don't understand the problem. Are you trying to add occupants to an existing seating chart (find where 2 can sit in the partially filled cinema) or are you trying to create a valid seating chart given a list of attendees (find seats for [1,1,1,1,1,1,2,2])? If the latter, I think there are 9715 unique solutions for your guest list. If you are trying to seat 11 1's there is only one solution. Do you need to find all solutions or just one?
Can A sit in seat[x][y]?

To determine if A can sit in seat[x][y], gather the occupants of all neighboring seats.

neighbors = (seat[x-1][y], seat[x+1][y], seat[x][y-1], seat[x][y+1])

If the seat[x][y] is occupied (!= 0), it is not available
If any neighbor == 1, the seat is not available.
If A == 1 and any neighbor != 0 the seat is not available.
Reply


Messages In This Thread
Help with list homework - by eyal123 - Nov-17-2022, 08:40 PM
RE: Help with list homework - by Yoriz - Nov-17-2022, 08:59 PM
RE: Help with list homework - by eyal123 - Nov-18-2022, 11:19 AM
RE: Help with list homework - by deanhystad - Nov-17-2022, 09:17 PM
RE: Help with list homework - by Yoriz - Nov-18-2022, 12:17 PM
RE: Help with list homework - by deanhystad - Nov-18-2022, 03:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework - List containing tuples containing dicti Men 4 2,065 Dec-28-2021, 12:37 AM
Last Post: Men
  Sorting list - Homework assigment ranbarr 1 2,272 May-16-2021, 04:45 PM
Last Post: Yoriz
  have homework to add a list to a list using append. celtickodiak 2 2,054 Oct-11-2019, 12:35 PM
Last Post: ibreeden
  Dictionary/List Homework ImLearningPython 22 10,725 Dec-17-2018, 12:12 AM
Last Post: ImLearningPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020