Analysis of real-time physical game called "Enemy/Defender"

I recently found out about this game called Enemy/Defender. Or perhaps Enemy-Defender or EnemyDefender. Regardless, here’s what you do: A group of people (we had maybe 30 or 40) stand in a circle. Each person chooses someone randomly and secretly to be their enemy. It could be the person standing next to you, or someone across the circle, someone you know, a complete stranger. Just pick someone besides yourself. It is quite possible that one person is nobody’s enemy, or that another person is the enemy of several people. Anyway, then each person picks a defender. You can’t pick yourself, and you can’t pick your enemy. Anyone else is okay.

Whoever is running it says, “Go!” and everyone immediately tries to get in a position such that their defender is between them and their enemy. Imagine that your enemy is trying to shoot you, and the only way to prevent them hitting you is by putting your defender in the path of the shot, so the defender gets hit and not you.

Before you read on, guess what you think happens when the game starts.

I assumed that people’s positions would eventually stabilize. We would eventually reach a layout where everyone was safely defended.

In retrospect, this was silly. Your enemy and your defender both have an enemy and a defender of their own, so they’re constantly trying to get on the non-enemy side of their defender, and everyone running around trying to get in the right place becomes very chaotic. Okay. But the surprising part is that everyone started circling around the middle of the room in the same direction. Someone noticed that it looked like the formation of a galaxy. Why does this happen? Does it have to do with human behavior, or would a computer simulation reach the same state? Has this game ever been analyzed in some way?

We also played a variant where you choose an enemy and someone to defend. In other words, you ARE the defender, and you have to get between the chosen enemy and another chosen player, who I guess would be called the target. In this case, there was still some rotation, but something else happened. Everyone crowded toward the middle, trying to squeeze in between their two chosen people.

So my question is, what exactly causes these things to happen? If we all tried to stop in the right place, would it be hard?

I assume everyone “fires” clockwise or everyone “fires” counterclockwise, right? After the first round everyone who wasn’t defended is eliminated and the next round begins with the remaining people?

flight, it doesn’t look to me like anyone “fires” at all: An enemy doesn’t even know at whom he’s supposed to be shooting. The running around preparing for the firing is the game.

As for the analysis: There are some stable situations. For example, with four players, you could have them all in a line, A B C D. If
A has enemy C and defender B
B has enemy D and defender C
C has enemy A and defender B
D has enemy B and defender C

then everyone will be defended. Furthermore, I very strongly suspect that, whenever the graph of enemies/defenders is such to allow any stable configuration, that that stable configuration will quickly be reached. Such a position would be a stable attractor. Incidentally, whenever such a position exists, there is a stable position which will be a straight line.

I further suspect that, in cases where there is no stable position (which I suspect is the case in the vast majority), the behaviour is chaotic, but with “everyone running in a circle” as a strange attractor. This would most likely follow from the rules of the game, not from the individuals. Of course, it’s arbitrary whether the circle is clockwise or counterclockwise. I might try coding up a simulation of this, just to see what happens.

Assuming everyone shoots clockwise, we would expect the circle to continually rotate clockwise. Why? The only time moving counterclockwise will make you more safe is if your enemy is immdediately counterclockwise to you. In any other case you are trying to move clockwise to get past you defender. Some people will move a little counterclockwise to get past their enemy and then hold still, until the circle rotates enough that they need to move clockwise to get past their defender who has passed them. Then you have a bunch of people who just need to get passed the next person. This rotation continues until everyone starts moving because they just need to get passed the next person or the pattern finds a stable position.

It probably will not though. I am not going to go into a detailed probability, but lets just say that the entire pattern is stable (everyone protected) except one person, C. C has chosen A-B-C (B defends C from A) and B has chosen A-C-B. B and C are each going to try to move clockwise past the other. They will never find a happy final postition and eventually their motions will require other people to need to move to keep up with them in order to preserve their good pattern. After a little while you have the whole group moving. This does not give any kind of proof, but it shows a likelihood.

flight, where are you pulling this clockwise/counterclockwise thing from? If the game actually does resolve to a rotation(so for we only have one account of the game being played, so it’s difficult to state for a foct) the direction would be determined by the number of people who choose an enemy or defender left or right of center, the spped of the players, and the shope of the circle. In other words, it should be completely random.

Now wee need to have the game played enough times so that we can find how much effect the Coriolis forces have :).

Chronos, a sim would be very neat. I’m sure there’s some boid workshop that could be suitably modified for the task.

flight, where are you pulling this clockwise/counterclockwise thing from? If the game actually does resolve to a rotation (so far we only have one account of the game being played, so it’s difficult to state for a fact) the direction would be determined by the number of people who choose an enemy or defender left or right of center, the speed of the players, and the shape of the circle. In other words, it should be completely random.

Now wee need to have the game played enough times so that we can find how much effect the Coriolis forces have :).

Chronos, a sim would be very neat. I’m sure there’s some boid workshop that could be suitably modified for the task.

[sub]Whoops, wrong button.[/sub]

Yes, exactly. Thank you for clarifying that; sorry.

The fact that everybody ends up clumped together with the version where you play the defender is pretty simple. Just imagine you and another male (assuming you are male) are trying to get between the other male and a female you both like. Eventually you’re going to be trying to push each other out of the way. It’s the gravity of love…

I suspect the opposite happens when you’re trying to be defended. Everyone is trying to get outside of the line segment created by their attacker and defender. This means being farther away from the attacker than the defender. When everyone is trying to get farther away from their attacker, you’re just going to keep spreading out, unless there’s a stable ending. The overall rotational direction is random, but is basically due to everyone chasing their defender.

Okay, this might be the most trouble I’ve ever taken to answer something on the SDMB but I actually did a simulation. Unfortunately, it wasn’t done in an environment that allows for easy applet distribution. Fortunately, I’ve made a movie file of some of the simulations.

Available here. (Requires Quicktime.)

The simulation has 20 players. A green line connects players with their defenders and a red line connects them to their attackers. Players are bright red dots.

At first I thought, hey, the best strategy is to get right behind your defender, and use him as a shield, regardless of where the attacker is. I thus made a simulation where players would just try to get closer to their defenders. Of course, the end result was pretty much everyone converging on the same point. The operative word, though is “pretty much”. As a matter of fact, the resulting behaviour was very reminiscent of Conway’s Game of Life, with oscillators occasionally forming.

I then did a slightly more accurate simulation, which is the one I used in the movie file, where players tried to go 5 pixels behind their defenders, in a position so that he would block them from their attackers. All players move at a constant speed and in a straight line from frame to frame. Positions are updated as the game plays, and not in between each frame, or “pass”.

In the movie, you’ll see players seemingly chasing each other off the screen. Are they moving in a straight line or just runing in a very wide ellipse? I don’t know. It might be an artifact of integer arithmetic, I don’t calculate positions with sub-pixel accuracy. I might have also screwed up the coding horribly - though I don’t think so. One real-life limitation that was omitted is space. Players have unlimited space to play the game, though they quickly run off screen.

Anyway, this is really fun to play with, thank god (I haven’t completely wasted my time.) Even though players only obey a very simple algorithm, their behaviour is very animal-like, much like the Game of Life.

Cheers.

Yahoo is giving me a “Unfortunately, we are unable to process your request at this time.” I’d love to see the file, and would be happy to put it up on my server, if it’s a Yahoo bandwidth issue.

Wow, jovan, you code a lot quicker than I do. As for your rules, I was thinking of something a little different. I was thinking that a person would try to move towards the closest point on the enemy-defender line, if that point was on the far side of the defender, or if it was not, to move straight toward the defender. In other words, take the ray originating with the defender and extend it in the direction away from the enemy, and a person would try to move to the closest point on that ray. I don’t like the idea of trying to maintain a specific distance from your defender, since it isn’t required for safety. Being closer would help you maneuver better should your enemy move out from behind your defender, but given that your enemy is not trying to move maliciously (he’s not trying to target you, he’s just trying to keep himself safe), I’m not sure that’s any advantage.

Also, of course, the physical game is played in some sort of confined area (a room, a city block, whatever), so there should be some boundary conditions. I’m not sure how the players should interact with the boundaries, though. If the playing area is convex, then I don’t think my algorithm would ever send a player out of the room, but I’m not sure. And a hybrid set of rules (for instance, starting the ray a fixed distance away from the defender, so as to prevent coalescence in the center) could send a player into a wall, at which point we’d have to figure out how to deal with that.

I also notice that many of your simulations result in a straight line… I wonder if those are the stable cases I mentioned in my earlier post, or if some folks are just left vulnerable and not able to move fast enough to reach a safe spot. Do you happen to have the raw data for the connections in each case?

And one further speculation, I’m almost certain that there should exist conserved quantities for any set of rules for this game, but I have no idea what they would be. It wouldn’t be linear momentum, since emnities are not mutual (thus breaking Newton’s Third Law), and it wouldn’t be angular momentum, since the “forces” are noncentral, but it seems to me there should be things vaguely analogous to linear and angular momentum. If there is an angular momentum analogue, it would probably allow us to quickly determine the eventual trend of rotation (if any) from any given initial state.

jovan, that’s awesome. Would you mind putting the code up somewhere so we could experiment with some different strategies?

Thanks. Unfortunately I did this using a “graphical programming” environment called MaxMSP. It’s pretty cool, in that it allows building stuff like this fairly quickly. Unfortunately, though, the code won’t make much sense unless you’re quite familiar with that software.

I did, however, try to compile a standalone. It’s available at the page I linked to above. You’ll need XP to run this baby, though. Unzip and run the file Defenders.exe. It might take a little while to startup but the app seems to run smoothly. You can set the number of players, play the game in real-time (with adjustable speed) or step through. Defender/Attacker as well as current position is listed for each player.

I also implemented Chronos’ suggestion: players now try to go to the closest point on the defender-attacker line, provided it is behind the defender. Otherwise, players go straight towards their defender. I did not implement boundaries. It makes the simulation less realistic, but I wanted to keep the rules simple. When faced with a wall, there’s probably a fair amount of psychology involved in real-life behaviour. Also, it makes the system more… consistent mathematically IMO.

You will notice that oscillators frequently form. As a matter of fact, there seems to be four patterns:

  1. Equilibrium is reached, players settle in positions where everyone is protected. This almost never happens unless you’re playing with a very small numbers of players.
  2. Some players find a safe position, while others oscillate between a few positions.
  3. Players chase each other into infinity. This is probably the most common pattern.
  4. Players follow a strange attractor, neither settling, oscillating nor running away.

I’m not sure (4) actually happens. It seemed to a few times but maybe I didn’t let the simulation run for long enough.

(3) Happens when two players defend each other and are very close. As one player moves behind his defender to protect himself, he leaves the defender open. The defender then moves back behind the first player and the loop is repeated with the players forever moving away from their starting positions. In a sense, this behaviour is partly due to the way I wrote the program: players move 5 pixels at a time, allowing them to “hop” over their defender. If this simulation was more accurate, I think case (3) would result in defender-defender pairs running in a circle.

Another real-life limitation that was ignored: two players can occupy the same point. In this version I actually compute positions with sub-pixel accuracy, so this rarely happens, though it might look like it on the screen.

Okay, I just tried it out IRL and what I wrote above was stupid. Obviously, players don’t hop over each other. However, when a player sees his defender moving towards him, he obviously back off to stay behind. The resulting pattern is the same as in the simulation: players running away for ever. (Or, in our case, until we ran into a wall.)

Sigh Forget about this, it was a bug. I fixed it and the pattern is gone. Oh well.

Now that the bugs are all gone, though, it works just like TJdude825 described. There is a definite trend towards clockwise motion. Running away doesn’t occur in a straight line anymore (oh, well) and generally the motion does ressemble an expanding spiral, though with definitive chaotic characteristics.

Why clockwise? I don’t know. Chronos mentioned something about angular momentum, would you mind expanding on that?