Samantha vacik
2025-06-26
Game of War is a traditional card game with varied rule sets, including whether to include or exclude the joker cards from the deck.
Standard decks have 52 cards of four suits and values ranging from 1 (Ace card) to 13 (King card) and the joker generally has a value of 14 in card games when included. If included in the Game of War, the joker gives players an advantage because it is the card that wins over all other cards, except another joker.
Hypothesis: There appears to be a linear relationship between the number of rounds a player wins and the total rounds per game, which increase the more wars occur. When jokers are included, the number of rounds would likely decrease. As a result, the R^2 value of a linear regression between the number of player rounds won and total rounds per game would increase and data points would cluster closer to a regression line when jokers are included in the deck.
Objective: A player wins the game by obtaining all cards through successive rounds.
Game Setup: Shuffle deck and deal cards evenly to two players. Each gets a total of 26 cards (excluding jokers) or 27 cards (including jokers).
Gameplay: Each round, the players play the top card of the deck face up and compare their values regardless of suit, color and face. The winner takes both cards and adds them to the bottom of their deck. If the cards were equal in value, the players would play a War round: each draws three cards and sets them face down, they draw fourth cards, and compare their values. This could result in going back to regularly drawing cards or it could resul in another round of war.
Winning Scenarios:
## [1] "Card Values"
## face value
## 1 Joker 14
## 2 King 13
## 3 Queen 12
## 4 Jack 11
## 5 Ten 10
## 6 Nine 9
## 7 Eight 8
## 8 Seven 7
## 9 Six 6
## 10 Five 5
## 11 Four 4
## 12 Three 3
## 13 Two 2
## 14 Ace 1
Code was developed in R to simulate the Game of War. Known limitations exist, such as a bug that can cause the program to stall and unknown potential of successive games of war. These will be fixed in future iterations of this code; however, the current iteration replicate game play and data consistent with games of war excluding and including jokers in the deck. :)
Furthermore, the linear relationship between player rounds won and total rounds is evident in this dataset. In this simulation, the probability of including jokers is set to 0.5 and 200 runs were conducted.
# regression line
reg.fitC <- lm(P1WarsWon ~ WarCount, data = WoJokers)
text_Cx <- min(WoJokers$WarCount) + (max(WoJokers$WarCount) - min(WoJokers$WarCount)) * 0.05
text_Cy <- max(WoJokers$P1WarsWon) - (max(WoJokers$P1WarsWon) - min(WoJokers$P1WarsWon)) * 0.15
reg.fitD <- lm(P1WarsWon ~ WarCount, data = WJokers)
text_Dx <- min(WJokers$WarCount) + (max(WJokers$WarCount) - min(WJokers$WarCount)) * 0.05
text_Dy <- max(WJokers$P1WarsWon) - (max(WJokers$P1WarsWon) - min(WJokers$P1WarsWon)) * 0.15
par(mfrow = c(1,2))
plot(WoJokers$WarCount, WoJokers$P1WarsWon, xlab = "Wars per Game", ylab = "P1 Wars Won per Game", col="orange")
abline(reg.fitC, col = "orange", lwd = 3)
text(text_Cx, text_Cy, labels = paste("Equation: y = ", round(coef(reg.fitC)[2], 2), "x + ", round(coef(reg.fitC)[1],2), "\nR-squared = ", round(summary(reg.fitC)$r.squared, 2)), pos = 4)
title(main = "Player 1 Wars Won: Excluding Jokers")
plot(WJokers$WarCount, WJokers$P1WarsWon, xlab = "Wars per Game", ylab = "P1 Wars Won per Game", col="orange")
abline(reg.fitC, col = "orange", lwd = 3)
text(text_Cx, text_Cy, labels = paste("Equation: y = ", round(coef(reg.fitC)[2], 2), "x + ", round(coef(reg.fitC)[1],2), "\nR-squared = ", round(summary(reg.fitC)$r.squared, 2)), pos = 4)
title(main = "Player 2 Wars Won: Including Jokers")As can be seen in this plot, the linear relationship is demonstrated between player wins and the number of rounds per game. When the jokers are included, the data points (blue) are closer to their linear regression line (blue) and there are fewer data points (blue) towards the maximum of the range of rounds, compared to when jokers are excluded (orange data points and regression line).
The app generates this same type of graph and allows the user to play around with probability (0.0 to 1.0 with a default setting of 0.5) of including/excluding the joker and the total number of runs per game (up to 150 total for a server-deployed app due to the unidentified bug affecting runtime). This allows the user to explore the simulation for themselves and see what results arise.