-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhigh_or_low.html
117 lines (110 loc) · 5.69 KB
/
high_or_low.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Projects - Cameron Kirk Engineering</title>
<link rel="stylesheet" type="text/css" href="stylesheet/stylesheet.css">
</head>
<body>
<div class="navbar">
<a href="index.html">Home</a>
<a href="bio.html">Bio</a>
<a href="projects.html">Projects</a>
<a href="pictures.html">Pictures</a>
</div>
<div class="main">
<img src="images/Projects/highorlow1.PNG" width=400px align="right" hspace="10">
<h2>High or Low Game</h2>
<h5>Unity Game Engine Project</h5>
<h3>Objective</h3>
<p>The purpose of this project was to create a card game</p>
<h3>Gameplay Flow</h3>
<ol>
<li>Standard deck of 52 playing cards.</li>
<li>Draw 2 cards.</li>
<li>Use numerical value of the card to determine
which card is "higher" or "lower".
</li>
<li>If the numerical values are equal then use suit value
to determine the "higher" card.
Suit hierarchy is Spades > Hearts > Diamonds > Clubs.
</li>
<li>Continue to draw two cards from the deck until it is depleted.
When no cards remain, return all cards to the deck and shuffle.
</li>
</ol>
<h3>Requirements</h3>
<ul>
<li>Hearts and Ace of Spades have increased chance
of being drawn. Each Heart Suit card should have
2X the chance of being drawn than the normal cards.
The Ace of Spades should have 3X the chance of being drawn
than the normal cards.
</li>
<li>The same card cannot appear twice in one draw (for example,
there cannot be two Ace of Spades on the table at once).
</li>
</ul>
<h3>Solution</h3>
<p>My game was created using Unity Game Engine.
I created a script responsible for placing and moving the cards on the screen.
I also created a second script responsible for the random selection of a card from
the deck.
</p>
<h4>Statistics Theory</h4>
<p>One important observation that was a instructive moment for
myself was how to handle increasing the chances of a card
being drawn. My first intuition was to just double or triple
the weight of the card, however it turned out to be incorrect.
It must be understood that when you double a card in the deck,
the total deck size will also increase. If the increase deck size
is not accounted for, then the sum of all probabilities will be
greater than 1. According to theory, the sum of all probabilities
must be equal to 1. In order to address this issue, I created a
second virtual deck that is seperate from the playing deck of
52 cards. This virtual deck size ended up being larger than 52.
I also had to create another boolean C# list to track which cards
were still in the playing deck. I then used the C# random function
to generate a random integer for the index of the virtual deck.
The card is then drawn from the playing deck and the virtual deck
is rebuilt.
</p>
<h4>Results</h4>
<p>This approach meant that my script will need
to iterate through the deck after every draw and rebuild
the virtual deck used for handling the probabilities.
I think that this will need improvement if more decks of
cards are involved and more complicated chance multipliers
are added.
</p>
<h4>Future work</h4>
<p>This approach meant that my script will need
to iterate through the deck after every draw and rebuild
the virtual deck used for handling the probabilities.
I think that this will need improvement if more decks of
cards are involved and more complicated chance multipliers
are added.
</p>
<h3>Pictures</h3>
<div class="gallery">
<a target="_blank" href="images/Projects/highorlow2.PNG" >
<img src="images/Projects/highorlow2.PNG" alt="Cinque Terre" width="600" height="400">
</a>
<div class="desc">Deck is empty and needs to be shuffled. All cards are in the discard pile</div>
</div>
<div class="gallery">
<a target="_blank" href="images/Projects/highorlow3.PNG" >
<img src="images/Projects/highorlow3.PNG" alt="Cinque Terre" width="600" height="400">
</a>
<div class="desc">King of Clubs is higher than Jack of Spades.
Right side is awarded a point</div>
</div>
<div class="gallery">
<a target="_blank" href="images/Projects/highorlow4.PNG" >
<img src="images/Projects/highorlow4.PNG" alt="Cinque Terre" width="600" height="400">
</a>
<div class="desc">King is higher than four of Spades. Left side is awarded a point.</div>
</div>
</div>
</body>
</html>