Native js implements a Lianliankan mini game (1)

A few days ago, I wrote a Lianliankan mini game using native js, address: Lianliankan (js) , the basic functions have been realized, and the running screenshot is:

Get development ideas according to the rules of the game

  1. Create a checkerboard
  2. Generate random unique numbers
  3. map to checkerboard
  4. mouse click event
  5. Pathfinding, if there is no path, go to 2, if there is a path, cancel
  6. Determine if the checkerboard is all dead

As long as you can complete the following small demos, you can complete a Lianliankan game (probably composed of the following parts)

  • Use html, css to complete a checkerboard (layout)
  • Randomly take numbers from an array and don't put them back (generates random non-repeating numbers)
  • Click on an item in a list to get the index of the item (when clicking on an item in the list, it can return the number of the item in the list)
  • Can operate array, stack method, queue method, split method, iterative method and merge method (push, pop, shift, splice, foreach, concat)
  • Find a path in the tic-tac-toe area formed by any non-repeating two points on the checkerboard (no vertices, one vertices, two vertices)

The hardest part: getting all the paths

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324834917&siteId=291194637