Skip to content

jesseoverright/war

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

war

an old coding exercise. over-engineered game of war written in PHP

Play War

$php index.php

Output

Jesse's hand: A ♦, 8 ♠
Computer's hand: 7 ♠, 8 ♣, 5 ♦, 9 ♦, 6 ♣, A ♥, 5 ♠, J ♦, 5 ♥, K ♦, 7 ♥, 9 ♣, 4 ♥, J ♥, 10 ♣, Q ♠, 4 ♣, J ♣, 9 ♥, K ♣, 3 ♣, 4 ♦, 3 ♠, K ♠, 6 ♠, 9 ♠, 7 ♣, Q ♥, 2 ♥, 5 ♣, 2 ♣, A ♠, 10 ♥, Q ♣, 7 ♦, 8 ♥, 2 ♦, 3 ♥, 3 ♦, 10 ♦, 6 ♥, 8 ♦, J ♠, A ♣, 2 ♠, 6 ♦, 10 ♠, Q ♦, 4 ♠, K ♥
Jesse plays: A ♦
Computer plays: 7 ♠
Jesse wins this round. Jesse collects A ♦, 7 ♠
Jesse's hand: 8 ♠, A ♦, 7 ♠
Computer's hand: 8 ♣, 5 ♦, 9 ♦, 6 ♣, A ♥, 5 ♠, J ♦, 5 ♥, K ♦, 7 ♥, 9 ♣, 4 ♥, J ♥, 10 ♣, Q ♠, 4 ♣, J ♣, 9 ♥, K ♣, 3 ♣, 4 ♦, 3 ♠, K ♠, 6 ♠, 9 ♠, 7 ♣, Q ♥, 2 ♥, 5 ♣, 2 ♣, A ♠, 10 ♥, Q ♣, 7 ♦, 8 ♥, 2 ♦, 3 ♥, 3 ♦, 10 ♦, 6 ♥, 8 ♦, J ♠, A ♣, 2 ♠, 6 ♦, 10 ♠, Q ♦, 4 ♠, K ♥
Jesse plays: 8 ♠
Computer plays: 8 ♣
WAR!
Both players add a card
Jesse plays: 7 ♠
Computer plays: 9 ♦
Computer wins this round. Computer collects 8 ♠, 8 ♣, A ♦, 5 ♦, 7 ♠, 9 ♦
Jesse's hand: empty.
Computer's hand: 6 ♣, A ♥, 5 ♠, J ♦, 5 ♥, K ♦, 7 ♥, 9 ♣, 4 ♥, J ♥, 10 ♣, Q ♠, 4 ♣, J ♣, 9 ♥, K ♣, 3 ♣, 4 ♦, 3 ♠, K ♠, 6 ♠, 9 ♠, 7 ♣, Q ♥, 2 ♥, 5 ♣, 2 ♣, A ♠, 10 ♥, Q ♣, 7 ♦, 8 ♥, 2 ♦, 3 ♥, 3 ♦, 10 ♦, 6 ♥, 8 ♦, J ♠, A ♣, 2 ♠, 6 ♦, 10 ♠, Q ♦, 4 ♠, K ♥, 8 ♠, 8 ♣, A ♦, 5 ♦, 7 ♠, 9 ♦
Congratulations Computer, you have won the war!

About

an old coding exercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages