Problem Solving of Mathematical Games

*David Ginat*

### **Abstract**

Mathematical games are problems that involve algorithmic solutions. The solutions require recognition of hidden patterns and capitalization on these patterns. The natural tendency of many problem solvers is to devise algorithms without fully unfolding patterns. Such an approach lacks rigor and may lead to undesired outcomes. This chapter underlines a rigorous approach, of first focusing on the characteristics of a posed game and then developing its algorithmic solution. The solution development "goes" hand-in-hand with the realization of correctness. The approach is based on declarative observations, which capture the "what" of patterns prior to the "how" of gamestrategy instructions. We illustrate the approach with colorful mathematical games of different characteristics and underline elements of solution processes, including creativity, problem-solving features, and mathematical notions.

**Keywords:** problem solving, Mathematical games, creativity, declarative and operational perspectives, invariance

#### **1. Introduction**

Mathematical games are mostly two-player games. Their specifications involve initial positions (states) and sets of rules for the players' moves. The two players play in alternating turns, and the game ends upon reaching a final position. The winner is usually the player who makes the last move. Most games are *complete information games*, in the sense that the game information is known at any given time to both players. The assumption is that each player always makes the best move available for her. Positions that lead to a win are *winning positions* for the player who moves next, and positions from which one will lose, regardless of her following moves, are *losing positions*. The player who moves first is *the first player*, and the other is *the second player*.

In most games, an *a priori* analysis of the game may "tell" which initial positions are winning positions and who will be the winner. The challenge for problem solvers is to employ an analysis that will reveal for each initial position whether it is a winning or a losing position and to offer a sound playing strategy for winning the game [1]. The winning strategy involves algorithmic instructions, based on unfolded underlying patterns. Recognition of hidden patterns and capitalization on patterns are the core of mathematical problem solving [2].

The primary inclination of many problem solvers is to invoke an *operational perspective* [3, 4], in which they focus on the instructions for the winner to follow (e.g., "if the

position is such, then apply move-1, else apply move-2"). However, such a route may lead to erroneous playing strategies as well as partial argumentation of correctness. A preceding *declarative (assertional) perspective* is desirable. Such perspective focuses primarily on explicit identification and specification of declarative characteristics of the problem (game) at hand, before devising algorithmic operations [3–5]. It expresses thinking at the problem level [6] of a given problem and constitutes the patterns on which an operational solution will be based and argued to be correct. A problem-solving process that combines declarative and operative perspectives enables zooming in and out between abstraction levels—the higher patterns level and the lower concrete-operation level [7].

In this chapter, we demonstrate the latter with problem-solving processes that involve creativity for revealing underlying, hidden patterns. The creativity is expressed with flexible thinking and associations [8, 9]. The displayed processes do not always end with explicit algorithmic statements, but rather with insightful patterns, from which the reader may infer the algorithmic operations and realize their justification.

The next section displays solution processes of colorful two-player games. The games are simply stated and involve basic mathematics, yet their problem solving is not straightforward. We posed the games to mathematics/computer science (math/CS) junior and senior students, including some CS Olympiad trainees, and observed diverse problem-solving approaches. We elaborate on our experience and shed light on characteristics of student behaviors.

#### **2. Operative and declarative game-solution routes**

This section displays different problem-solving processes that illuminate the assets and importance of the declarative perspective. The section is divided into five subsections. Each sub-section illustrates, with one or more games, a feature that appears in game problem solving. The problem solving of some games involves more than one feature. Some features are general in mathematics and/or algorithmics, beyond problem solving of games.

In a displayed problem-solving process, we lead the reader through constructive and creative observations [2]. When the reader will follow a presented solution process, the train of thought may seem simple, since it is developed through suitable observations. Yet, in our experience, many problem solvers struggle. We use the conventions of calling the first player in all the games *Alice* and the second player *Beth*. In addition, we do not always indicate winning/losing positions; and in one game the last to move is not necessarily the winner.

#### **2.1 Pairing**

The first game involves basic geometry. The solution of the game is based on *a priori* pairing of game elements, such that when a player engages one of the elements of a pair, the response to that is to engage the element that was *a priori* paired with this element.

#### **2.2 Closed shape on a grid**

Alice and Beth play a game of connecting points in an M × N grid, in alternating turns. Each player, on her turn, connects two adjacent points, vertically or horizontally, which were not yet connected. Alice plays first. She connects points with red lines. Beth connects points with blue lines. Alice's goal is to obtain a closed polygon

composed of *solely* red lines. Beth's goal is to prevent Alice from obtaining her goal. Would you prefer to be Alice or Beth in order to win the game?

**Figure 1** shows a possible instantiation of the game, which ended in Alice's win. The last move in the game, made by Alice, was the drawing of a red line that "closed" the perimeter of the red polygon. (It could be any of the red lines of the perimeter.) Beth may win in another possible instantiation of the game, if she will manage to "interrupt" Alice so that there will be no red-perimeter polygon.

#### **Figure 1.** *A game that ended in Alice's win.*

Problem solvers play the game with one another and offer various heuristic rules. Many feel that Beth may always win the game, but their strategies of line drawing are often vague and not rigorously justified. They attempt different strategies for "blocking" Alice but are unable to pinpoint a solid problem characteristic on which to capitalize. They experience difficulties with relating the game rules to a concrete property of "blocking." A creative, declarative perspective observation unfolds such a property.

• *Every polygon has a bottom-right corner, of a* **┘** *shape, composed of a vertical line and a horizontal line.*

This simple property captures elegantly a characteristic of *every* polygon on the grid. It involves **pairing** of the two lines that compose the specified corner. A winning strategy for Beth is rather clear—for every new red line that Alice will draw, Beth will respond with its paired line (that will be blue), such that the two lines will compose a bottom-right corner. (Some boundary lines need no response.) The justification is

**Figure 2.** *Blue-line responses of Beth to Alice's red lines.*

clear from the above characteristic. The two possible blue-line responses of Beth for a red line of Alice are displayed in **Figure 2**.

They key point in solving the game is that of relating a suitable "grid-polygon" property to the idea of "blocking." We noticed that such property may be tied to the playing feature of pairing (which will also appear in later games here). But just invoking pairing is insufficient. One has to examine polygon characteristics and identify a property to tie to pairing. Those who do not seek a corresponding polygon property do not reach a sound solution.

#### **2.3 Invariance**

The game below involves collection of numbers in a line. Unlike many mathematical games, it may end in a draw. The challenge is to devise a strategy that will lead to a win or a draw. It was posed as the first task of the 1996 International Olympiad in Informatics (IOI'96) [10]. The game solution is based on unfolding an appearance of the mathematical feature of invariance. Many problem solvers do not turn to this feature.
