knight | R Documentation |
Generating function for a chess knight on an infinite
d
-dimensional chessboard
knight(d, can_stay_still = FALSE)
d |
Dimension of the board |
can_stay_still |
Boolean, with default |
The function is a slight modification of spray::knight()
.
Robin K. S. Hankin
knight(2) # regular chess knight on a regular chess board
knight(2,TRUE) # regular chess knight that can stay still
# Q: how many ways are there for a 4D knight to return to its starting
# square after four moves?
# A:
constant(knight(4)^4)
# Q ...and how many ways in four moves or fewer?
# A1:
constant(knight(4,TRUE)^4)
# A2:
constant((1+knight(4))^4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.