Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Yes, you are being asked to build four cages, but you are also being asked to place pigs in them so their numbers in each cage are odd. To me, the pig placement is clearly part of the problem and therefore the various pig placement solutions are important. The "How can you do that?" is vague enough to include the pig arrangements.A farmer asks you to build 4 changes to hold his 9 pigs and he wants to you put an odd number of pigs in each cage. Each cage must contain at least 1 pig.
How can you do that?
lionelhill said:If you open the door to a cage, and see within it an even number of cages, then this topology won't work.
lionelhill said:At a glance, it's obvious that Sam's topologies 2 and 3 have no solutions.
Not quite true because on inner cages you can have lone pigs walking around those even number of cages, as long as they are enclosed in a bigger cage. This makes solutions for topologies 2 and 3 possible.lionelhill said:Since Sam's observation is true not only of the outermost cage, but also of inner sets of cages, it can be used to test any arrangement of cages for pig-worthiness. If you open the door to a cage, and see within it an even number of cages, then this topology won't work.
$ ./pigs
Topology 1: {{P} P} {P} {P}
1. {{1} 0}, {5}, {3}
2. {{1} 0}, {7}, {1}
3. {{1} 2}, {3}, {3}
4. {{1} 2}, {5}, {1}
5. {{1} 4}, {3}, {1}
6. {{1} 6}, {1}, {1}
7. {{3} 0}, {3}, {3}
8. {{3} 0}, {5}, {1}
9. {{3} 2}, {3}, {1}
10. {{3} 4}, {1}, {1}
11. {{5} 0}, {3}, {1}
12. {{5} 2}, {1}, {1}
13. {{7} 0}, {1}, {1}
13 solutions
Topology 2: {{{{P} P} P} P}
14. {{{{1} 0} 0} 8}
15. {{{{1} 0} 2} 6}
16. {{{{1} 0} 4} 4}
17. {{{{1} 0} 6} 2}
18. {{{{1} 0} 8} 0}
19. {{{{1} 2} 0} 6}
20. {{{{1} 2} 2} 4}
21. {{{{1} 2} 4} 2}
22. {{{{1} 2} 6} 0}
23. {{{{1} 4} 0} 4}
24. {{{{1} 4} 2} 2}
25. {{{{1} 4} 4} 0}
26. {{{{1} 6} 0} 2}
27. {{{{1} 6} 2} 0}
28. {{{{1} 8} 0} 0}
29. {{{{3} 0} 0} 6}
30. {{{{3} 0} 2} 4}
31. {{{{3} 0} 4} 2}
32. {{{{3} 0} 6} 0}
33. {{{{3} 2} 0} 4}
34. {{{{3} 2} 2} 2}
35. {{{{3} 2} 4} 0}
36. {{{{3} 4} 0} 2}
37. {{{{3} 4} 2} 0}
38. {{{{3} 6} 0} 0}
39. {{{{5} 0} 0} 4}
40. {{{{5} 0} 2} 2}
41. {{{{5} 0} 4} 0}
42. {{{{5} 2} 0} 2}
43. {{{{5} 2} 2} 0}
44. {{{{5} 4} 0} 0}
45. {{{{7} 0} 0} 2}
46. {{{{7} 0} 2} 0}
47. {{{{7} 2} 0} 0}
48. {{{{9} 0} 0} 0}
35 solutions
Topology 3: {{P} {P} {P} P }
49. {{1} {1} {1} 6}
50. {{3} {1} {1} 4}
51. {{3} {3} {1} 2}
52. {{3} {3} {3} 0}
53. {{5} {1} {1} 2}
54. {{5} {3} {1} 0}
55. {{7} {1} {1} 0}
7 solutions
Topology 4: {{{P} {P} P} P }
56. {{{1} {1} 1} 6}
57. {{{1} {1} 3} 4}
58. {{{1} {1} 5} 2}
59. {{{1} {1} 7} 0}
60. {{{3} {1} 1} 4}
61. {{{3} {1} 3} 2}
62. {{{3} {1} 5} 0}
63. {{{3} {3} 1} 2}
64. {{{3} {3} 3} 0}
65. {{{5} {1} 1} 2}
66. {{{5} {1} 3} 0}
67. {{{5} {3} 1} 0}
68. {{{7} {1} 1} 0}
13 solutions
Topology 4: {{{P} {P} P} P }
69. {{{1} 0} {1} 7}
70. {{{1} 0} {3} 5}
71. {{{1} 0} {5} 3}
72. {{{1} 0} {7} 1}
73. {{{1} 2} {1} 5}
74. {{{1} 2} {3} 3}
75. {{{1} 2} {5} 1}
76. {{{1} 4} {1} 3}
77. {{{1} 4} {3} 1}
78. {{{1} 6} {1} 1}
79. {{{3} 0} {1} 5}
80. {{{3} 0} {3} 3}
81. {{{3} 0} {5} 1}
82. {{{3} 2} {1} 3}
83. {{{3} 2} {3} 1}
84. {{{3} 4} {1} 1}
85. {{{5} 0} {1} 3}
86. {{{5} 0} {3} 1}
87. {{{5} 2} {1} 1}
88. {{{7} 0} {1} 1}
20 solutions