Prolog difficulties with cinema seats problem.
Hello. I have this project to do for my AI class but it's kind of tricky. I really do need help. The given problem is to create a program in Prolog that represents the way seats are given out in a theatre. People come in parties of 2-8 and the restrictions are that parties of 2,3,5,7 are all seated in one row. Parties of 6,8 are seated in two consecutive rows (3 and 3 or 4 and 4) and so on. Each row is represented by a list, which holds zeros for empty seats and one's for occupied seats. I cant find a way to fill the seats with one's, for example i can check if a row has two consecutive free seats (altough i dont know how i can check for more than two) but i dont know how to replace the zeros with one's. Anyway overall help in this problem would be greatly appreciated because i'm new in programming with Prolog. Thanks in advance. PS: as you can see i havent gone very far yet. Any help at all would be great.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement