Directed Grabbing Games or How to Politely Grab the Maximum Number of Olives in a Reception
Abstract
We introduce and study the directed grabbing game, a directed variation of the graph grabbing game played by two players Alice and Bob on a weighted acyclic digraph D. Alice plays first and then they play alternately. At a given odd (resp. even) move, Alice (resp. Bob) chooses a sink, that is a vertex of out-degree 0, grabs the weight (olives) on it and then removes the vertex. The aim of each player is to grab a maximum weight, i.e. a maximum number of olives. This game is inspired by the behaviour that guests are expected to adopt during a reception or cocktail party.
We first consider the case where hors d’oeuvre are arranged on slightly spaced parallel lines, such that politeness allows one to take the first hors d’oeuvre from each line. This corresponds to the directed grabbing game on a union of disjoint directed paths. We give an algorithm that, given a weighted digraph of order which is the union of disjoint directed paths, computes an optimal play in time.
Then we consider the “pissaladière case” where the digraph is a directed -grid. We show that, depending on the parity of , one player, called Content, has a strategic advantage. Specifically, Content is Alice when is odd and Bob when is even. We present some strategies that enable Content to remove some large sets of vertices (of order ) in directed grids. We then derive that Content can remove any given vertex that is not in the border of the grid. Finally, in the case where each vertex contains either zero or one olive, we prove that Content can secure the grabbing of around one third of the olives.
Keywords and phrases:
grabbing games, paths, directed gridsFunding:
Takako Kodate: International Academic Exchange Fund from Tokyo Woman’s Christian University.Copyright and License:
2012 ACM Subject Classification:
Mathematics of computing Graph algorithmsFunding:
French government, through the UCAjedi Investments in the Future project managed by the National Research Agency (ANR) with the reference number ANR-15-IDEX-01.Editor:
John IaconoSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Graph grabbing and graph sharing games have been introduced by P. Winkler in [5] and have since attracted a lot of attention (see the references in [2]). In such games, two players Alice and Bob play alternatively on a connected graph with non-negative weights assigned to the vertices. There are some differences according to the rule taken to grab a vertex. The aim of each player is to grab a maximum weight.
A standard rule is rule (R) that imposes that the subgraph induced by the taken vertices is connected during the whole game. The most famous cases, introduced by P. Winkler in his famous book Mathematical Puzzles [6], are the ones when the graph is a path and a cycle and the problems are entitled Coins in a Row and Sharing a Pizza.
In the case of a cycle P. Winkler shows that if the number of vertices (slices of the pizza) is even Alice can always get at least half of the weight. In contrast, and quite surprisingly, when the number of vertices is odd, the maximum fraction of the total weight that Alice can always grab is only [1, 4]. In [2], we studied in details the case of a path (under the name Sharing a Linear Pizza). During the presentation of our results at FUN 2022, Tomasz Idziaszek informed us that he has obtained in 2012 a linear-time algorithm to determine the gain of each player ( [3]).
In [2], we introduced the -degenerate rule (Dd) yielding to the -degenerate game.
- (Dd):
-
At each move, a player can only pick a -removable vertex, which is a vertex of degree at most in the remaining graph.
Of course, with such a rule, the graph can be entirely shared (i.e. all the vertices can be removed) only if at each step there is a removable vertex. This is the case if and only if the graph is -degenerate. Recall that a graph is -degenerate if each of its subgraphs has a vertex of degree at most . The -degenerate connected graphs are the trees. In particular, the -degenerate game on a path is exactly Coins in a Row.
In [2], Hungry Coatis focused on a particularly important case (at least for them), called Sharing a pissaladière. “Pissaladière” is marvelous dish of higher importance to the authors, originally a specialty of the French city of Nice (under the name “pissaladeria”) and of Liguria (under the name “piscialandrea”). The classical pissaladière is presented as a rectangular grid where the slices are small rectangles. Its traditional topping consists of caramelised (almost pureed) onions, anchovies and delicious small black olives of Nice, of which everyone is fond. The politeness dictates that players take turns picking a slice which is adjacent to at most two other slices. Hence, in the first move Alice can only pick one of the four corners of the pissaladière, and in the second move Bob can only pick one of the three remaining corners or one of the two slices adjacent to the corner removed by Alice. Grids are -degenerate graphs and the -degenerate game on grids is exactly Sharing a Pissaladière.
In this paper, we introduce and study the directed grabbing game, which is a directed variation played on a weighted acyclic digraph . There are two players Alice a.k.a. and Bob a.k.a. . Alice plays first; then they play alternately. At a given odd (resp. even) move, Alice (resp. Bob) chooses a sink, that is a vertex of out-degree , grabs the weight (olives) on it and then removes the vertex. The aim of each player is to grab a maximum weight, i.e. a maximum number of olives.
This game is inspired by the behaviour that guests are expected to adopt during a reception or cocktail party. On such occasions, hors d’oeuvres are arranged on trays of various shapes, and it is considered quite rude to take a piece that is behind another. Thus, by representing each hors d’oeuvre as a vertex and drawing an arc from one to another if the first is located behind the second, we obtain an acyclic digraph in which only the sinks can be chosen. Moreover, since hors d’oeuvres are generally not of equal quality, we can assign each a weight corresponding to the pleasure derived from eating it. If two people are gathered around the same tray, politeness also dictates that they take turns. But of course, beneath this veneer of courtesy, each person will try to maximize their own pleasure – that is, to take hors d’oeuvres/vertices such that the sum of the weights is as large as possible.
A classic setting appears when the hors d’oeuvres are arranged on slightly spaced parallel lines, such that politeness allows one to take the first hors d’oeuvre from each line. It corresponds to playing on a digraph which is the union of disjoint directed paths (see Figure 1).
Another popular case is pissaladière where there are olives on each piece and each player wants to eat as many olives as possible. The traditional shape of pissaladières is rectangular, and at receptions, they are often presented on a table along a wall, with one corner of the rectangle pointing toward the guests. The guests must then begin eating the pissaladières starting from that corner. In such a case, the digraph is a directed grid (see Figure 2).
1.1 Our results
We first deal with the case of general weights.
In Section 2 we prove the intuitive result stating that, if a vertex is a sink with maximum weight, then there is an optimal play starting with .
In Section 3, we consider the first setting of hors d’oeuvre. We give an algorithm that, given a weighted digraph of order which is the union of disjoint directed paths, computes an optimal play in time.
Next, we consider the “pissaladière case” where the digraph is a directed grid (see precise definition in Section 4). We establish two opposite behaviours depending on whether the grid has an odd or an even number of vertices (i.e. depending on whether is odd or even). Let Content be Alice when is odd and Bob when is even, and let Defeated be Bob when is odd and Alice when is even. We establish several results showing that Content has a strategic advantage on a directed grid.
First, in Section 4, we present some strategies which enable Content to remove some large sets of vertices (or order ) in directed grids. Then, in Section 5, using the previously established strategies, we determine which player removes a given vertex. In particular, we show in Theorem 15 that if the vertex is not in the border (i.e. the union of the first row and first column), then Content removes it. Finally, in Section 6, we restrict our study to the case where is a -valued function. This corresponds to the case of a pissaladière where there is zero or one olive on each piece. In particular, we give bounds on the minimum number of olives that a player collects over all possible games with olives on . We show in Proposition 19 that Defeated is not guaranteed to collect any olive unless the number of olives is at least half the size of the grid. In contrast, we prove in Theorem 22 that Content can always collect at least one third of the olives minus a small constant and even more when the number of olives becomes large compared to the size of the grid.
We conclude the paper in Section 7, by giving some open problems.
1.2 Definitions
Let be a weighted acyclic digraph. A configuration at time is the configuration obtained after moves. So the configuration at time is the initial digraph. Move is the move played by a player between time and time . It is the removal by the player of a sink (vertex of out-degree ) in the configuration at time . So the first move of Alice is move 1 between time and time .
A play is a sequence of moves made alternately by Alice and Bob. This is an acyclic ordering of , that is an ordering of the vertices such that there is no arc with .
Observe that if the digraph has a hamiltonian dipath ( being the sink), then its unique acyclic ordering (and thus play) is , so Alice grabs the weight of odd-indexed vertices and Bob those of even-indexed vertices.
The (odd) moves done by Alice in a play will be called the play of or -play and denoted by , while the (even moves) done by Bob will be called the play of or -play and denoted by . Thus a play is the alternate sequence of elements of and in order. We write .
We denote by (resp. ) the weight collected by Alice (resp. Bob) when these players remove the vertices according to the play . The value of a play in is .
An optimal play is a sequence of moves made alternately by Alice and Bob when they both play optimally, that is according to the classical MiniMax recursive algorithm on the game tree. More precisely Alice (resp. Bob) has a -strategy if Alice (resp. Bob) grabs at least a weight whatever Bob (resp. Alice) plays. The optimal gain of Alice (resp. Bob), denoted by (resp. is the maximum such that Alice (resp. Bob) has an -strategy. This strategy will be called optimal. The optimal value of , denoted by , is the value of an optimal play, which is equal to .
2 Removing a sink with maximum weight
The distance between two weight functions and of is .
Lemma 1.
Let be an acyclic digraph and and be two weight functions at distance . Then .
Proof.
Let and be optimal plays for and respectively. We have and .
Similarly we get .
A maximum-weight vertex in is a vertex such that for all .
Lemma 2.
Let be a weighted acyclic digraph. If is a sink and maximum-weight vertex, then there is an optimal play starting with .
Proof.
We prove the result by induction on the number of vertices of , the result holding trivially for .
Assume now that , and that there is a vertex with out-degree with maximum weight. Let be an optimal play for . If , then we have the result. Henceforth, we may assume that . Now, the induction hypothesis applied to (in which is a sink and a maximum-weight vertex) implies that there is an optimal play for starting with . Thus, we may assume that . Let . We have .
Let be the maximal value of a play starting with and optimal afterwards. . Let be the weight function defined on by if and otherwise. Observe that in , is a sink and a maximum-weight vertex. By the induction hypothesis, there is an optimal play starting with . So . Thus, by Lemma 1, . Hence . Therefore, there is an optimal play starting with .
3 Union of disjoint directed paths
Let be the union of disjoint directed paths and a vertex of . If , then the unique out-neighbour of in is denoted by . If , then the unique in-neighbour of in is denoted by .
The aim of Propositions 3 and 5 is to give reductions which relate the value of to the value of a weighted digraph obtained by deleting two vertices of (and adjusting some weights). Repeating these reductions, we will end to compute the value of a set of disjoint directed paths where the weights on each directed path are strictly increasing and where the value can be computed in time.
Proposition 3 (First reduction).
Let be a union of disjoint directed paths, and a weight function on .
If and , and , then
Proof.
Assume is even.
Bob can play the following strategy. Bob never removes vertex . This is possible because is even and has to be removed before . If Alice removes a vertex in , then Bob plays according to an optimal strategy on . If Alice removes , then Bob removes . Doing so Bob collects at least so
| (1) |
Alice can play the following strategy. If Bob removes , then Alice removes . Otherwise she removes if possible a vertex of ; but as is even, at the end Alice is forced to remove . Doing so, Alice collects either if Bob removes , or if Alice removes at the end. Since , we get
| (2) |
When is odd, the proof is similar with the role of Alice and Bob interchanged.
Definition 4 (-contract of ).
If , then the -contract of is the weighted digraph where is the digraph obtained from by contracting the vertices into a single vertex and is defined by and for every . See Figure 4.
Proposition 5 (Second reduction).
Let be the union of disjoint directed paths, and weight function on . Suppose that there is one directed path of and an index , , such that is and . Then where is the -contract of .
Proof.
We first prove that .
To do so we construct simultaneously move by move two plays, one in and one in . In , Alice plays an optimal strategy resulting in a play denoted by and in Bob plays an optimal strategy resulting in a play denoted by . In , we construct an -play (not necessarily optimal) for Alice which follows (mimics) and in we construct a -play (not necessarily optimal) for Bob which follows . In particular, if Alice removes, according to , a vertex not in , we impose that Alice removes the same vertex in the simultaneous move in . Similarly, if Bob removes, according to , a vertex not in , we impose that Bob removes the same vertex in the simultaneous move in .
We consider the first move when either Bob removes vertex in with -play (Case 1) or Alice removes vertex in with -play (Case 2). Note that in the moves strictly before , Alice has been imposed to remove the same vertices in and because follows , and Bob has been imposed to remove the same vertices in and because follows .
-
Case 1: At move (even), Bob removes vertex with -play in and has not been removed in by Alice with strategy . In that case, the vertices have been all removed in and and we impose Bob to remove vertex within at move .
Let be the first move after when Alice removes a vertex in with -play in . In the odd moves strictly before (if any), Alice removes a vertex not in with -play in , and we impose that Alice removes the same vertex in the simultaneous move in . In the even moves strictly before , if Bob removes a vertex in not in with -play , we impose that Bob removes the same vertex in the simultaneous move in . If Bob removes a vertex ( in with -play , we impose that, in the simultaneous move in , Bob removes the vertex which is the first available. We note that move exists because, as with the above conditions, Bob will not remove before Alice removes a vertex of . We also note that is odd and .
Let () be the vertex removed by Alice at move . Then we impose that Bob removes with -play in move vertex . Then, for the end of the plays, we impose that Alice removes with -play in at move () the same vertex as the one removed by Alice in at move with -play . We impose that Bob removes in at move () the same vertex as the one removed by Bob with -play in at move .
In summary in this Case 1, Alice has removed in (according to ) the same vertices as in (according to ) plus . As for , we have:
-
Case 2: At move (odd), Alice removes vertex with -play in and has not been removed by Bob with -play in . Then we impose that Bob removes vertex within at move .
We also impose that in all the moves after , if Alice removes a vertex with -play at a move , then Alice removes the same vertex in move in with -play . We also impose that, if Bob removes vertex at move with -play in , then Bob removes the same vertex in at move with -play .
We now distinguish two sub-cases.
-
–
Sub-case 2.1: Alice removes vertex with at some odd move . Bob cannot have removed vertex in with in a move before otherwise Bob would have removed in a move before and so cannot be removed by Alice at move . Then we impose that Alice removes vertex at move in with . Therefore Bob cannot remove .
-
–
Sub-case 2.2: Bob removes vertex with at some even move . Alice cannot have removed in at a move before , otherwise Alice would have removed in before move . Then we impose that Bob removes vertex at move in with and so Alice will never remove .
In Sub-case 2.1, Alice has removed the same vertices in as in . Furthermore Alice has removed and in while Alice has removed in with weight . Thus:
In Sub-case 2.2, Alice has removed the same vertices in as in plus . Thus:
-
–
Recall that and . Thus . Similarly, . Moreover, by construction, .
is a play obtained by playing an optimal strategy and is not necessarily optimal, thus . As in both above subcases , we get:
Now is a -play obtained by playing an optimal strategy and is not necessarily optimal. Thus and so
One can prove in a similar way. More precisely, Alice plays in an optimal strategy resulting in a -play and Bob plays in an optimal strategy resulting in a . We construct in an -play for Alice that follows , and in a -play for Bob that follows . The proof is the same as above by interchanging the roles of Alice and Bob.
Corollary 6.
Given a weighted digraph of order which is the union of disjoint directed paths an optimal play can be computed in time.
Proof.
The algorithm proceeds at follows. It first reduces each component of using the first and second reduction. Note that this can be done in linear time in since the reduction applies (if any) around the smallest index such that .
After such a reduction, we obtain a union of disjoint directed paths such that the weight function is strictly increasing on each directed path. In particular, at each turn the maximum-weight vertex will be a sink and thus removable. Therefore, by an easy induction with Lemma 2, there is an optimal play in which each player removes the maximum-weight vertex at each step. Hence, it suffices to sort the vertices in increasing order of their weight to get an optimal play. This corresponds to merging the sorted lists into a single sorted list, which can be done in time using heaps.
4 Strategies to collect some fixed set of vertices in grids
Definition 7.
The directed grid is the cartesian product of two directed paths. (See Figure 5). More precisely, its vertex and arc set are
It has rows , , and columns, , . Hence the vertex in row and column is . Observe that in , vertex is the unique sink, the vertices of have out-degree , and all others vertices have out-degree .
Let be an acyclic digraph and let be a set of vertices. We say that a player has an -strategy if has a strategy to remove all vertices of . A trivial example is that Alice has an -strategy for every sink of , because Alice can remove in her first move.
In this section, we describe some strategies for Bob and Alice to remove some of the following sets of vertices of the grid.
We start with two very simple strategies for Bob, which are symmetric to each other.
Theorem 8.
-
(i)
If is even, then Bob has a -strategy. In other words, Bob can remove all the vertices of the even columns.
-
(ii)
If is even, then Bob has an -strategy. In other words, Bob can remove all the vertices of the even rows.
Proof.
-
(i)
When is even, Bob can apply the following strategy.
If Alice removes for some and , then Bob removes .
Observe that Bob can apply this strategy all play long. Indeed when it is Alice’s turn to play, only vertices in odd-columns are removable. Doing so Bob remove all vertices of .
-
(ii)
Symmetrically, when is even, Bob can apply the following strategy and remove all vertices of .
If Alice removes for some and , then Bob removes .
When and have different parities, Bob can apply similar strategies, either for odd columns if is even after some bootstrap in the first column, or for odd rows if is even after some bootstrap in the first row. These two strategies are symmetric to each other.
Theorem 9.
-
(i)
If is even and is odd, then Bob has a -strategy. In other words, Bob can remove the vertices of the first column in even rows and all the vertices of the other odd columns.
-
(ii)
If is odd and is even, then Bob has an -strategy. In other words, Bob can remove the vertices of the first row in even columns and all the vertices of the other odd rows.
Proof.
-
(i)
Assume is even and is odd. Bob can apply the following strategy.
If Alice removes a vertex for some , then Bob removes .
If Alice removes a vertex for some , then Bob removes the vertex .When it is Alice’s turn to play, two cases may occur. If the first column has not been fully removed, then the removable vertices are one odd-row vertex in the first column and some vertices in even columns. If the first column has been removed and perhaps some pairs of columns (in an even number of moves as is even), then only vertices in even columns are removable. In both cases, Alice can never remove a vertex in .
-
(ii)
Assume is odd and is even. The proof of (ii) is symmetric to (i). An -strategy for Bob is the following.
If Alice removes a vertex for some , then Bob removes .
If Alice removes a vertex for some , then Bob removes the vertex .
We now give some strategies for Alice when is odd.
Theorem 10.
-
(i)
If is odd, then Alice has a -strategy. In other words, Alice can remove the vertices of column in odd rows and all the vertices of the other odd columns.
-
(ii)
If is odd, then Alice has an -strategy. In other words, Alice can remove the vertices of row in odd columns and all the vertices of the other odd rows.
Proof.
-
(i)
Assume and are both odd. Alice can apply the following strategy.
If Bob removes a vertex for some , then Alice removes .
If Bob removes a vertex for some , then Alice removes .When it is Bob’s turn to play, two cases may occur. If the first column has not been fully removed, then the removable vertices are one even-row vertex in the first column and some vertices in even columns (indeed as is odd Alice could have applied the second rule). If the first column has been removed and perhaps some pairs of others consecutive even-odd columns (in an odd number of moves as is odd), then only vertices in even columns are removable. In both cases, Bob can never remove a vertex in .
-
(ii)
The proof is symmetric to (i). An -strategy for Alice is the following.
If Bob removes a vertex for some , then Alice removes .
If Bob removes a vertex for some , then Alice removes .
We now describe more elaborate strategies which will enable Alice or Bob to remove vertices not removed by the simple strategies above. Let us specify some definitions and notations.
A configuration of the play on the grid at time is completely determined by the numbers of vertices that have not been removed from rows . Said otherwise, vertex has been removed for and vertex has not been removed for . Clearly, at any time , we have . At the beginning of the game (time ), we have for all . At time , we have . This sum is even when either is odd and is odd, or is even and is even.
We note that a vertex is removable at move if it is of the form with . Furthermore if , then after the removal of at move , we have , so the vertex to the right becomes removable.
Theorem 11.
If is odd, then Alice has an -strategy. In other words, Alice can remove all the vertices in both even rows and even columns.
Proof.
A configuration on the grid at time odd is -good if there exists a non-negative , shortly denoted by , such that
-
1.
for ,
-
2.
is even, and
-
3.
is odd for .
Observe that if the configuration at time odd is -good, no vertex of is removable by Bob at move . Indeed, recall that a removable vertex is of the form with . For , there are only removable vertices in odd rows, and so not in . For , is odd, so a removable vertex in row is in an odd column and so not in .
Hence, it suffices for Alice to leave an -good configuration after each of her moves to collect all vertices of . We shall now prove by induction on , that Alice has a strategy to do so. In her first move, Alice necessarily removes vertex . So (which is even) and (which is odd) for all . Thus, the configuration at time is -good with . This proves the base case of the induction. The inductive case is the following claim.
Claim 12.
Suppose that the configuration at time odd is -good. Then, whatever vertex Bob removes at move , Alice can always remove a vertex so that the configuration at time is also -good.
Proof of the claim.
-
Suppose Bob removes vertex in a row (at move ).
Hence is necessarily odd. Then Alice removes the vertex below which is now removable as . Consequently, , and for all . Hence, since the configuration at time was -good, so the configuration at time is also -good with .
-
Suppose Bob removes vertex . Necessarily, .
If , Alice removes the vertex on the right . Consequently, (which is even) and for all . Hence, since the configuration at time was -good, so is the configuration at time with .
If , we note that is odd. Let be the smallest value such that . Then is removable and Alice removes it. Then is even. Furthermore, for all , is odd. So the configuration at time is -good with .
-
Suppose Bob removes vertex . That implies that .
If , then Alice removes the vertex on the right . This results in an -good configuration with because is odd, and for all .
If , then Alice removes the vertex below . This results in an -good configuration with because is even, , and for all .
-
Suppose Bob removes a vertex with . Note that (as both values are odd) and so Alice removes vertex . This results in an -good configuration with because is odd, and for all .
The claim is proved and therefore also the theorem.
When is even using similar ideas, we will show that Bob has also a strategy to remove vertices not removed by Theorems 8 and 9.
Theorem 13.
-
(a)
If is even and is odd, then Bob has an -strategy. In other words, Bob can remove all the vertices that are in both odd rows and even columns.
-
(b)
If is odd and is even, then Bob has an -strategy. In other words, Bob can remove all the vertices that are in both even rows and odd columns.
-
(c)
If and are even, then Bob has an -strategy. In other words, Bob can remove all the vertices that are either in both odd rows and odd columns except the first one or in the first column and even rows.
-
(d)
If and are even, Bob has an -strategy. In other words, Bob can remove all the vertices that are either in both odd columns and odd rows except the first one or in the first row and even columns.
Proof.
By symmetry, it is sufficient to prove the proposition for even, that is for cases (a) and (c). We want to show that, when is odd (resp. even), Bob has an -strategy (resp. -strategy).
A configuration on the grid (with even) at time even is -good if there exists , shortly denoted by , and , shortly denoted by , such that , and the following hold:
-
1.
if , then ;
-
2.
if , then for ;
-
3.
if , then is even;
-
4.
is odd for .
-
5.
for .
Observe that if the configuration at time even is -good and if is odd (resp even), no vertex of (resp. ) is removable by Alice at move . Indeed, if there exists a removable vertex in row , then it is in an even row and not in the first column, and so not in neither in . If is odd and the removable vertex is in row , it is in an odd column, and so not in . If is even and , the removable vertex is in an even column, and so not in . If is even , the removable vertex is , and so it is not in .
Hence, it suffices for Bob to leave a -good configuration after each of his moves to collect all vertices of (resp. ) if is odd (resp. even). We shall now prove by induction on , that Bob has a strategy to do so. At time , for all , so the configuration is -good with . This proves the base case of the induction. The inductive case is the following claim.
Claim 14.
Suppose that the configuration at time even is -good. Then whatever vertex Alice removes at move , Bob can always remove a vertex so that the configuration at time is -good.
Proof of the claim.
The proof is very similar to the proof of Claim 12. We just indicate how Bob replies to the possible moves of Alice.
-
Suppose Alice removes a vertex in a row . It must be in an even row due to condition 2, so the removed vertex is for some . (). Then Bob removes the vertex below which is removable as .
-
Suppose Alice removes a vertex in row namely (with ). This implies that .
If , then Bob removes the vertex on the right .
If , we note that is odd. Let be the smallest index such that . Then is removable and Bob removes it. (-good configuration with ).
-
If suppose Alice removes vertex with .
If then Bob removes the vertex on the right .
If which happens only if , then Bob removes the vertex (note that for parity reason, and so is odd) (-good configuration with ).
-
Suppose Alice removes the vertex .
Suppose is odd. If , then Bob removes the vertex on the right . If which implies Bob removes the vertex . Suppose is even. Then Bob removes the vertex .
The claim is proved and therefore also the theorem.
5 Weight on a unique vertex
In this section, we study the case where all the weight is located at a unique vertex, which will be denoted by . In other words and for all . In this case, the objective of both players is to remove the vertex . Hence, we say that a player wins if he removes .
The strategies defined in the preceding section enable us to easily determine the winner in the case where is neither in the first row nor in the first column.
Theorem 15.
If with and , then Alice wins if is odd and Bob wins if is even.
Proof.
Assume is odd. If (resp. ) is odd, then is in (resp. ), so Alice can remove by Theorem 10. If and are even, then , so Alice can remove by Theorem 11.
Assume is even. By symmetry, we can suppose that is even. If is even, then , so Bob can remove by Theorem 8. Henceforth, we may assume is odd. We distinguish two cases depending on the parity of .
Suppose is even. If is even, then , so Bob can remove by Theorem 8. If is odd, then , so Bob can remove by Theorem 13.
Suppose is odd. If is odd, then , so Bob can remove by Theorem 9. If is even, then , so Bob can remove by Theorem 13.
Theorem 16.
If , then Alice wins.
If , with , then Alice wins if and only if is odd and is odd.
If , , then Alice wins if and only if is odd and is odd.
Proof.
If , then Alice takes it at the first move and so wins.
Suppose that with . If a player removes vertex , then the other will grab . So the aim of each player is to avoid removing . A player can remove safely any “safe” vertex with . The number of such safe vertices is . If is odd, which happens when is odd and odd, then Bob is obliged to remove and Alice wins. Otherwise if is even, then Alice is obliged to remove and Bob wins.
The proof is similar when the olive with . Here the number of safe vertices is . So Alice wins when this number is odd, that is when is odd and is odd, and Bob wins otherwise.
6 Minimum number of olives that can be collected by a player
In this section, we consider the case where the weight function is a -valued function. In such a case, is completely determined by the set . This set is then called the olive set and its elements the olives. The cardinality of is often denoted by . Let be an acyclic graph on vertices and let be an olive set of cardinality . Then for , we denote by the number of olives that collects in the directed grabbing game, if both players play optimally. Note that .
We denote by the number of olives that () is sure to collect. In other words, is the minimum number of olives that collects over all possible games with olives:
By definition, . Moreover, when the set contains the first vertices of an acyclic ordering of , then by Lemma 2, there is an optimal play in which the olives are taken on the first moves. Thus and , and so and . Finally, Alice collects at most vertices and Bob collects at most vertices. So and . Thus
| (3) | |||
| (4) |
The existence of -strategies yields some bounds on and .
Lemma 17.
Let be an acyclic digraph and let . If has an -strategy, then for all and for all .
Proof.
Assume first . Take a subset of of size . Applying his -strategy, can remove all the vertices of and in particular all the olives. Hence , and thus .
Assume now . Take a set of size which contains . Applying his -strategy, can remove all the vertices of and thus collects at least olives. Hence , and thus .
Lemma 18.
Let be an acyclic digraph, be a positive integer and for all . If has an -strategy for all , then, for every , we have
Proof.
Set . Let be a set of olives on . Set . Observe that . Now, if has an -strategy for all , then applying the most profitable of those strategies, can collect at least olives. Hence . Since this is true for any set of olives, we have the result.
Proposition 19.
-
(i)
If is even, then .
-
(ii)
If is odd, then .
Proof.
-
(i)
If is even, then either is even or is even. By symmetry, we may assume is even.
- (ii)
This proposition shows that when is even (resp.odd), then Alice (resp. Bob) is not guaranteed to get any olive unless the number of olives is bigger than half the vertices, so that Bob (resp. Alice) cannot collect all of them. Hence, the main challenge is to determine when is odd and when is even.
When is small compared to and , then those parameters are equal to because the opponent has strategies to remove some small set of vertices on which all the olives can be.
Let . It is the set of vertices that are either in both the first row and an even column, or both the first column and an even row distinct from . Note that .
Proposition 20.
-
(i)
If is odd, then Bob has an -strategy.
-
(ii)
If is even and is odd, then Alice has a -strategy.
-
(iii)
If is odd and is even, then Alice has an -strategy.
Proof.
-
(i)
At the first move, Alice removes and at the second move Bob grabs the olive on .
We use the terminology defined before Theorem 11. A configuration on the grid at an even time is -good if the following conditions hold:
-
(a)
or is odd ;
-
(b)
either (a) or (b) there exists an () such that for and for or (c) for all i.
Observe that, if the configuration at an even time is -good, then no vertex of is removable by Alice at move . Indeed, if there exists a removable vertex in , it is in an odd column and so not in . If the removable vertex is in , then it is either in row or in an odd row, and so not in . Hence, it suffices for Bob to leave a -good configuration after each of his moves to collect all vertices of . We shall now prove by induction on , that Bob has a strategy to do so. At time , is odd and . This proves the base case of the induction. Suppose that the configuration at an even time is -good. Then we claim that whatever vertex Alice removes at move , Bob can always remove a vertex so that the configuration at time is -good.
Assume Alice removes a vertex in . This vertex is either of the form ( in which case Bob removes , or () in which case Bob removes the removable vertex in . In both cases, we are still in a -good configuration.
Assume Alice removes a vertex in . If we are in case (a), then , and Bob removes vertex . If we are in case (b) then, either ( and Bob removes vertex (, or and Bob removes the removable vertex in . In all cases, we are in a -good configuration.
Assume Alice removes a vertex with both and . If both and have been removed, then Bob removes any removable vertex. So w.l.o.g. suppose has not been removed and let be the last vertex removed in . The set of removable vertices at time is included in an even set as is even. So, as the number of vertices removed at time is even and Alice was able to remove a vertex, there exists at time at least one removable vertex with and . Then Bob removes this vertex and leaves a -good configuration.
-
(a)
-
(ii)
Suppose is even and is odd. Alice grabs at the first move. Then, as is odd, Bob will be obliged to play first in (it suffices to Alice to play in row till Bob plays in ). Then Alice grabs the olive . And so on, due to parity, Alice never plays in till Bob is forced to play there and Alice grabs . In summary, Alice grabs all the olives of .
-
(iii)
is symmetric to (ii).
Corollary 21.
-
(i)
If is odd, then for all .
-
(ii)
If is odd and is even, then for all .
-
(iii)
If is even and is odd, then for all .
-
(iv)
If is even and is even, then and for all .
Proof.
(iv) follows from the fact that, when and are both even, Bob can grab any olive except by Theorems 15 and 16.
The strategies proved in Section 4 and Lemma 18 yield the following bounds on when is odd and when is even.
Theorem 22.
-
(i)
If is odd, then .
-
(ii)
If is odd and is even, then .
-
(iii)
If is even and is odd, then .
-
(iv)
If is even and is even, then
.
Proof.
By Equations (3) (resp. (4)), we have (resp. is at least when is odd (resp. even). Let us prove the other lower bounds.
- (i)
- (ii)
-
(iii)
is symmetric to (ii).
-
(iv)
Assume and are even. Then Bob has a -strategy, an -strategy by Theorem 8, and an -strategy and an -strategy by Theorem 13(c). Hence, Lemma 18 applied firstly to the four sets , , , yields . Moreover, Lemma 18 applied firstly to the three sets , , , and secondly to the three sets , , , yields . Finally, Lemma 18 applied to and yields .
7 Further research
7.1 Digraph covered by directed paths
Let be an acyclic digraph covered by directed paths. At each step, at most vertices are sinks (at most one per path). Therefore, subdigraphs may appear during the Directed Grabbing game, and value of the game can be computed by dynamic programming in using the formula:
Hence a natural question is whether faster and ideally linear-time algorithms exist?
Problem 23.
Does there exist an algorithm that given a digraph covered by directed paths computes an optimal play in time, or at least time?
The answer is affirmative when . One can easily construct a linear-time algorithm that computes an optimal play for the Directed Grabbing game on a given weighted acyclic digraph which is covered by two directed paths. The question is open for larger values of .
7.2 Improving bounds on and
Recall that Content, which we denote by , is Alice when is odd and Bob otherwise. In Theorem 22, we gave lower bounds on . Those bounds are piecewise linear with successive slopes , , , and . It would be nice to investigate whether they are optimal or not. In particular, establishing upper bounds on that are significantly lower than the trivial or would be nice.
Studying carefully the -grid, we are able to prove for all . We can then derive that, when is even, for all . This needs to be completed.
7.3 Average gain
In this paper, we only considered the minimum gains of both players ( and ) but other parameters could also be studied. One natural candidate is the average gain, denoted by , and defined as the expected number of olives that a player collects in the directed grabbing game when averaging over all possible sets of olives in .
By definition
Assume . Using the strategies of Section 4, Content can remove two fixed sets of at least vertices of , which in average contain olives each. Using probabilistic arguments, we are able to show that . Thus Content collects a bit more than half of the olives in average (when the number of olives is small compared to the size of the grid). A natural question is whether Content collects in average a fraction strictly larger than one half of the olives.
Problem 24.
Does there exists a positive constant such that when and are sufficiently large?
It might even be possible that as it is the case when by Theorem 15. (Here must be understood as a function tending to when and tend to infinity.)
References
- [1] Josef Cibulka, Jan Kyncl, Viola Mészáros, Rudolf Stolar, and Pavel Valtr. Solution of Peter Winkler’s pizza problem. In Jirí Fiala, Jan Kratochvíl, and Mirka Miller, editors, International Workshop on Combinatorial Algorithms - IWOCA, volume 5874 of Lecture Notes in Computer Science, pages 356–367. Springer, 2009. doi:10.1007/978-3-642-10217-2_35.
- [2] Hungry Coatis. Grabbing Olives on Linear Pizzas and Pissaladières. In The Eleventh International Conference on Fun with Algorithms (FUN 2022), Island of Favignana, Italy, May 2022. doi:10.4230/LIPIcs.FUN.2022.12.
- [3] Tomasz Idziaszek. An optimal algorithm for calculating the profit in the coins in a row game. https://www.mimuw.edu.pl/ idziaszek/termity/termity.pdf. (An overwiew of his result was published in 2012 in "Looking for a Challenge" book at the university of Warsaw)., 2012.
- [4] Kolja Knauer, Piotr Micek, and Torsten Ueckerdt. How to eat 4/9 of a pizza. Discrete Mathematics, 311(16):1635–1645, 2011. doi:10.1016/j.disc.2011.03.015.
- [5] Peter Winkler. Mathematical Puzzles: a connoisseur’s collection. CRC Press, 2004.
- [6] Peter Winkler. Mathematical Puzzles. A K Peters CRC Press, 2020.
