"2 Against 1" Game and "Color by Grids" Tool

One is a board game and the other a coloring tool

The "2 Against 1" game was based off of a game I used to play with my dad as a child. The game begins with 12 pieces arranged on a 4 by 4 grid. Half of the pieces belong to one player, the other half the second. Each turn, a player moves one of his or her pieces across the board horizontally or vertically, one space at a time. If the pieces are ever arranged in such a way that a row or column has at least two of one player's pieces and only of the other player's pieces, arranged in the order "XXO" or "OXX", the player who has only one piece in that row or column loses that piece. Note that an arrangement such as "XXOO" would not result in anyone losing any pieces. Whoever loses all their pieces first loses. I hope to progrm this game so that other people would be able to enjoy the game I used to play with my dad when I was little. I wasn't able to get my code to do exactly what I want, though I was able to simulate a square game board of circles, with each circle representing a piece or an empty space. Whenever each circle is clicked, the color changes cyclically from white, to blue, to red, to white again. This idea of changing colors also inspired me to code "Color by Grids," in which each small square on a grid changes colors when clicked. The order of color change for "Color by Grid" is white, silver, gray, black, maroon, red, orange, yellow, olive, lime, green, aqua, teal, blue, navy, purple, and fuchsia. I think this would be a fun coloring tool for young children to play with.

Built with

  • javas
  • jsbin

Try it out