Home Page Forums Puzzles A Game

  • A Game

    Posted by Vivek on March 15, 2021 at 5:19 pm


    This is a html code for a game. It displays 10 numbers vertically with two buttons on either side of each number- blue and green. If blue button is clicked, The entire sequence from where it is clicked gets reversed. If the green button is clicked, That number is exchanged with the next number. Once the button is clicked, It will disappear. That is, Each button can be clicked exactly once. The goal is to arrange the numbers in ascending order using those buttons. Proving that it is always possible to arrange the numbers in ascending order, is also an interesting question…

    Vivek replied 1 year, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Puzzle Prime

    March 15, 2021 at 7:17 pm

    Hey Vivek,

    This looks like a fun puzzle, I will think about it!

    If you don’t mind, I can host the game, so that people can play it without downloading the html file? If the code is yours, let me know so that I add “by Vivek” at the bottom:)

    • Vivek

      March 15, 2021 at 7:33 pm

      Hi Artur, Years back while we were learning about sorting, I thought of this game, like randomly adding certain powers like flipping two adjacent numbers, using functions. I used to play with mobile numbers and randomly generated numbers, with functions like f(5) meaning exchange 5th number with the next. Later programmed it in Android with buttons. Then , Tried this in html with the limited knowledge in html code. If you can improve it, It will be great , Artur 🙂 This one, I feel, is not that much appealing , like we have to zoom in, to get better view. Also there is no need for repeated numbers and the limit of 10 numbers , is due to the screen size. I think we can improve it a bit.