![]() ![]() To demonstrate, here is the same board initialized as non-classic mode, with the same light being pressed. If you want to play the non-classic game mode, where pressing a light toggles the entire row and column, then use the classic = FALSE argument of either new_board() or random_board(). Notice how the light at (2,3) and its 4 neighbours are flipped. ![]() Let's press the light at (2,3) - row 2, column 3 # Press light at (2,3) All the coordinates in lightsout are treated as (row,column). Pressing a light will cause that light and all its adjacent lights to toggle (in classic mode, which is the default). Pressing a light is done with the play() function. lights_vector Lights Out 3x3 boardĪny board generated by random_board() is guaranteed to be solvable, but since we defined this board ourselves, it's a good idea to make sure it's solvable before attempting to play it. If a vector is provided, then it is read row-by-row rather than column-by-column. The first argument is either a matrix or a vector of the lights, with all values being either 0 (light off) or 1 (light on). You can also use the new_board() function to create a new board if you want to provide your own defined set of lights. The first argument to the function is the board dimensions (number of rows and columns), which is restricted to be either 3, 5, 7, or 9. The generated board is guaranteed to be solvable. You can use the random_board() function to initialize a new Lights Out game with a random configuration of lights. Other than the Shiny app that lets you play the game visually, you can also interact with lightsout using the command line. Clicking on the Show solution button will highlight all the lights that need to be pressed in order to solve the current board. The darker green lights represent lights that are off, and the brighter green lights are lights that are on. In this image, there is a 5x5 Lights Out board. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |