Is my understanding of reflections correct?
I'm solvin开发者_运维知识库g the classical eight queens problem in prolog. And now I'm about to start coding the bit that removes reflections about the horizontal line. Y=4. Say if the point (3.3) is reflected, the new point would be (6,6), is that correct? Another example, (2,1) would become (7,8).
The ones you show are not reflections but rotations.
The reflection along the vertical center-axis (flip left-right) of a square
(x,y)
is given by(9-x,y)
(assuming1<=x,y<=8
).The reflection along the horizontal center-axis (flip top-bottom) is given by
(x,9-y)
.The reflection by both axes (aka rotation) is given by
(9-x,9-y)
精彩评论