Use the Standard deck to create a simplified version of the game War. In this game, there are two players. Each starts with half of a deck. The players each deal the top card from their decks and whoever has the higher card wins the other player’s cards and adds them to the bottom of his deck. If there is a tie, the two cards are eliminated from play (this differs from the actual game, but is simpler to program). The game ends when one player runs out of cards.
- multiprocessing
- need to use the multiprocessing library as the GIL does not allow python threads to run concurrently
- check if this is needed
- use deque in the simulation as inserting at index 0 is very slow
- store the tuple in this and not the Card as described below
- no refcounting this way ig
- store the tuple in this and not the Card as described below
- implement the deque using numpy arrays
- only ranks matter for the game, so they should be filled with only ranks
- but how do i collect data on freq of each rank being left at the end?
- maybe store a tuple in it instead:
(<rank>, <index in deck>)
- maybe store a tuple in it instead:
- why would this be faster with numpy if i use deque anyway?
- implement this in a faster language like Rust or Cpp
- implementing this in rust and then using matplotlib to visualise this data should be easy as PyO3 can be used to generate a python lib, when can then be used in a python environment just like regualr python functions/classes
- freq of turns
- freq of the number of cards left
- freq of each rank being left at the end
- freq of each rank having a tie in the game
- should be possible to just calculate the probability of this happening :/