Content uploaded by Bertrand Teguia

Author content

All content in this area was uploaded by Bertrand Teguia on Apr 26, 2019

Content may be subject to copyright.

A game inspired by Mathematics

P&C Game

Bertrand Teguia Tabuguia

April 26, 2019

A game inspired by Mathematics P&C Game

Abstract

We present an original implementation of Joel Spencer Paul and Carole game.

Contents

1 Introduction 1

2 Presentation 2

3 Playing P&C Game 4

4 The Simple level particularity 5

List of Figures

1 P&CGamemainscreen.............................. 2

2 P&CGameauthor................................. 2

3 P&CGameinstructions.............................. 3

4 P&CGamegameplay............................... 3

5 P&CGamewinningscreen. ........................... 4

6 P&C Game Simple level or Prime level. . . . . . . . . . . . . . . . . . . . . . 5

1 Introduction

The inspiration came from the use of the Paul and Carole game in Optimal Control by Sylvia

Serfaty [1]. Impressed by that theory, the author added usual fun love relationship between

two partners. Thus the boundary of the domain is taken as Carole’s heart boundary whose

Paul wants to cross. The game was ﬁrst implemented in python with the pygame [2] library

for Windows and Linux operating systems computer. The particularity of this implemen-

tation was the possibility of challenge between two players, this feature might be recovered

in the future using network connexion. However the game actually appears to be nicer and

competitive on browsers as a one player game.

Although we have a strategy developed from Optimal Control to win such a game, winning

a part is not easy in practice. Moreover, more interest has been given by the author to its

implementation due to his use of a typical randomness [3] based on prime numbers distribu-

tion in the Simple level.

In the sequel we give classical scenario of P&C Game game play and end up with a brief

description about the interest behind its Simple level.

P&C Game 1Bertrand Teguia

A game inspired by Mathematics P&C Game

2 Presentation

We consider the computer device view of the game. Indeed the game can be played on any

device. The ﬁrst screen is as follow

Figure 1: P&C Game main screen.

As we can see, there are 5 buttons. Let us start by the red ones.

1. The button About: provides information about the game development

Figure 2: P&C Game author.

P&C Game 2Bertrand Teguia

A game inspired by Mathematics P&C Game

2. The button Help: provides the game instructions

Figure 3: P&C Game instructions.

For these two previous screenshots, the player has to click on O.K to come back in the

main menu.

Let us now show how the screen looks like while playing. If for example we choose Simple

level we will obtain something like

Figure 4: P&C Game game play.

Let us give some explanations about what is displayed on the screen

•Of course, we have the heart and Paul (P) inside the heart.

P&C Game 3Bertrand Teguia

A game inspired by Mathematics P&C Game

•Steps indicates the number of click the the player has already made.

•Game time indicates the timing in seconds of the duration of the game play.

•Remaining Distance indicates a distance estimation from Paul position to Carole’s

boundary heart.

•The counting on the right shows 10 seconds decreasing during which the player has to

play/click.

•The button New Game allows the player to come back to the main screen at any time.

Next we show an example of winning screen

Figure 5: P&C Game winning screen.

When the player win, the game provides him a nice animation of his motion on the trajectory

he used. And on the top left corner of the screen he can see his performance, here level 0,

198 steps in 72 seconds. Furthermore, when the player performs a better score, which means

good timing and less clicks, that score is updated and he gets an additional congratulation.

For comparison with another player, one can use any norm on the plan with coordinates

(Steps, Game time) to get a single value of the score.

3 Playing P&C Game

We play it with a mouse or ﬁngers (depending on the device), just by clicking. Paul (for the

player) wants to go out of Carole’s heart. Paul chooses path lines and Carole chooses path

directions. The player have to ﬁnd an optimal strategy of choosing lines to win the game

with less steps and less time. There are three levels, Simple level or the Prime level, level 1

and level 2 (ﬁdelity level).

P&C Game 4Bertrand Teguia

A game inspired by Mathematics P&C Game

4 The Simple level particularity

In the Simple level, the author implemented his pseudo random integer generator for 2

patterns corresponding here to Carole choices. The winning screen above is actually not a

real winning screen, in fact it correspond to the ﬁrst implementation with the use of the

celebrate Mersenne Twister algorithm. The new one however might be very interesting for

future studies on prime numbers distribution, because the author uses prime gap to simulate

randomness. For seeding he uses a bijection between couple of positive rational numbers and

prime numbers, this is done by using a composition of maps in the following way

Q+×Q+−→ N×N−→ N−→ P,

where Q+is the set of positive rational numbers, Nthe set of integers and Pthe set of primes.

For more details about the random generator used see [3].

Figure 6: P&C Game Simple level or Prime level.

P&C Game 5Bertrand Teguia

A game inspired by Mathematics P&C Game

After playing that new Simple level, a comparison with the old one seems to predict that

the old was better understood than the new. But it does not make sense since it was good

imitation of randomness, therefore one could rather say that the apparent diﬃculty added is

linked to a certain behavior of primes, or it is just our minds playing tricks because we were

already used with the previous implementation. Nevertheless, can we be used with random?

The discussion is long. . .

Remark: P&C Game can be played online on any browser on the link

https://bertrand-t3gu1.itch.io/pc-game-web

P&C Game 6Bertrand Teguia

A game inspired by Mathematics P&C Game

References

[1] Robert V Kohn and Sylvia Serfaty. Second-order pde’s and deterministic games. In Proc.

Internat. Congress Ind. Appl. Math.(ICIAM’07), pages 239–249, 2009.

[2] Albert Sweigart. Making Games with Python & Pygame. CreateSpace North Charleston,

2012.

[3] Bertrand Teguia T. An algorithmic random integer generator based on prime numbers

distributions. 2019.

P&C Game 7Bertrand Teguia