You are on page 1of 22

UNIVERSITI MALAYSIA TERENGGANU

CSF 3001
DISCRETE STRUCTURE

FULLSTACK JACK CARD GAME

GROUP 21
TEOH YI YIN S58798
NURUL HUDA BINTI AHMAD TAJUDDIN S59597
NUR SYAFIQA BINTI MOHAMAD S60355
TABLE OF CONTENTS

1. Introduction 3
1.1 Background of the game 3-4
1.2 Reason 5
2. Logical statement 6-12
3. Formal statement 13-14
4. Game program 15-21
5. Conclusion 22-23
6. References 24

2
1. Introduction

1.1 Background of the game

All fours which are also mentioned as seven up, are the ancestors of a family of card
games dating back to England within the 17th century and first listed in Charles Cotton's The
Full Gamester in 1674. Formerly referred to as the knave, the face card owes its modern jack
name to this game. All fours were originally thought to be a lower-class game. It was widely
played on slave plantations by African Americans, but it broadened its social horizons within
the 19th century and led to more-elaborate games such as cinch, pitch, smear, and don,
including partnership play, bidding, or additional scoring cards.

Jack cards of all 4 suits

The game's title refers to its four key scoring points:

i. High. The highest trump in play was reached by a point scored by the player.
ii. Low. The lowest trump in play or winning it in a trick in some later versions was one
point earned by the player.
iii. Jack. The player scored one point by catching the trump jack in a trick.
iv. Game. The player captures the greatest value of counting cards in tricks by one point.

3
As not all cards are being dealt, it is possible for the jack to be the only trump in play,
during which case it scores three points, one each for high, low, and jack. In descending
order, when taken in tricks, the ranks and values against the game point are ace four, king
three, queen two, jack one, 10 index value, and other zero ranks. This offers 80 points in total,
although some value cards are normally out of play.

A player is dealt six cards within the simple two-player game, three from a 52-card
deck at a time. As a possible trump suit, the top card of the remaining pack is then turned
approach. The dealer scores one point if it is a jack. The target is to earn as many of the four
scoring points as possible.

"The nondealer may accept the turned card as a trump by saying, I stand," during
which case play begins, or reject it by saying, "Beg." If the nondealer begs, the dealer may
accept by saying, I give you one," within which case one point is scored by the other player
and play begins, or may "refuse the gift," within which case the exposed card is turned down,
three more cards are dealt to each player, and another trump card is revealed. Until a new suit
appears, this procedure continues. This fresh suit is trumped immediately, and the dealer
scores one point if the turned card is a jack. The deal is scrapped if no new suit emerges
before the cards run out, and the same dealer deals again. Otherwise, by discarding the extras
facedown before play starts, the players then reduce their hands to six cards. (This is always
missed if a new trump is formed in the first run, so there are nine tricks instead of six.)

The non-dealer leads to the first trick, and each trick's winner leads to the next. The
second player to a trick can, as desired, openly follow suit or play a trump, but may only
discard from another suit if it is unable to follow suit. The trick is taken by the leading suit's
highest card, or by the highest trump if one is played. Points are awarded at the end of the
hand, and the game earns seven points (which is why the game is also called seven up).

4
1.2 Reason
There are a few reasons why we chose this card game as our project. This game can be
more than just a fun way to pass time. While we typically think full stack jack card online
games as child’s play, the joy of it does not wear off with age. In fact, reconnecting with the
more childlike aspects of yourself could improve your psychological outlook.

With the fast paced, technology driven world of today, loneliness becomes an
increasingly common experience. For people experiencing depression, anxiety or any other
forms of mental illness, this loneliness may lead to a tendency to isolate. Playing this game
can make it easier for people to break the ice socially and can motivate you to spend time
with others. Playing is in fact the first way we begin to socialise as children, and there is an
organic and spontaneous element to building interpersonal relationships through this game.
Playing an online game of cards helps conversation flow easily, encourages teamwork and
fosters a spirit of friendly competition.

A third of Australians in the workforce report experiencing stress, anxiety and


depression, which could give a negative impact on your physical, emotional and mental
health. Taking time to relax and do something you enjoy is a major act of self-care. A weekly
full stack jack card online game with friends or a family game night can help shift focus away
from daily stressors, like work, bills and other personal challenges, onto a pleasurable and
low-stakes task. Keep your game nights filled with laughter and chatter, and avoid playing for
large sums of money to maximise the stress-reducing benefits of playing online card games.

A full stack jack card online game involves some form of strategy, which exercises
the mind's problem-solving capabilities in which keeps your mind sharp and active. With age,
using different parts of the brain every day becomes increasingly important for preventing
memory loss and dementia. Just learning the rules of this game can encourage cognitive skills
like memorisation and communication. A deck of cards can even be used to promote learning
in other areas, for example, if you’re taking on a new language, incorporating a few phrases
into the game can give you a chance to practice and reinforce vocabulary words. It is totally a
fun yet beneficial game. This game is not only easy to play but its program is also very easy
to understand. By this, we believe that this game is the perfect choice for new learners like us
to appreciate the importance of discrete mathematics in programming.

5
2. Logical Statement

1. At the beginning, the system orders the players to enter 1 to draw a card. If players enter
1 then the players draw a card

Code segment

int response = userInput.nextInt();


if(response == 1){
player1Cards.draw(playingDeck);
player2Cards.draw(playingDeck);

Scene before

Scene after

2. If player one has the highest card value than player two then player one receives a point.

Code segment

if(player1Cards.cardsValue() > player2Cards.cardsValue()){


p1++;
System.out.println("Player1 card =
"+player1Cards.toString()+ ". Player2 card =
"+player2Cards.toString());
System.out.println ("Player 1 win one point ");

6
Scene before

Scene after

3. If player two has the highest card value than player one then player two receives a point.

Code segment

if(player1Cards.cardsValue() > player2Cards.cardsValue()){


p1++;
System.out.println("Player1 card = "+player1Cards.toString()+ ".
Player2 card = "+player2Cards.toString());
System.out.println ("Player 1 win one point ");

}else if (player1Cards.cardsValue() < player2Cards.cardsValue()){


p2++;
System.out.println("Player1 card = "+player1Cards.toString()+ ".
Player2 card = "+player2Cards.toString());
System.out.println ("Player 2 win one point ");
}

Scene before

7
Scene after

4. If points accumulated by player one are higher than player two then player one wins.

Code segment

if(p1 > p2 ){
System.out.println("Player 1 wins "+ p1 + " to "+ p2 + "!");

Scene before

8
Scene after

5. If points accumulated by player two are higher than player one then player two wins.

Code segment

if(p1 > p2 ){
System.out.println("Player 1 wins "+ p1 + " to "+ p2 + "!");

}else if( p2 > p1){


System.out.println("Player 2 wins "+p2 + " to "+ p1 + "!");

9
Scene before

Scene after

10
6. If both players have the same points then the game is tied.

Code segment

if(p1 > p2 ){
System.out.println("Player 1 wins "+ p1 + " to "+ p2 + "!");

}else if( p2 > p1){


System.out.println("Player 2 wins "+p2 + " to "+ p1 + "!");

}else{ System.out.println( "Tie!");


}

Scene before

11
Scene after

12
3. Formal Statement

1. At the beginning the player ask to enter 1 to draw a card. If player enter 1 then
the players draw a card

 Let D is a set of Response


 The players draw a card if the response = 1
In formal statement
∀ D∈ Z ∨D={1}→ draw

2. If player one has highest card value than player two then player one receives a
point.

 Let Player is a set of players that consists of Player1 and Player2


 Let Card is a set of card consist of Player1Card and Player2Card
 Player one win represented by a function Win (Player1)
 Let P is a set of score obtained by Player1 and Player2

In formal statement
∀ Player 1 , Player 2 ∈ Player∨Player 1Card > Player 2Card
→ Win ( Player 1 ) , P(Player 1)

3. If player two has highest card value than player one then player two receives a
point.

 Let Player is a set of players that consists of Player1 and Player2


 Let Card is a set of card consist of Player1Card and Player2Card
 Player two win represented by a function Win (Player2)
 Let P is a set of score obtained by Player1 and Player2

In formal statement
∀ Player 1 , Player 2 ∈ Player∨Player 1Card < Player 2Car
→ Win ( Player 2 ) , P(Player 2)

13
4. If points accumulate by player one has highest than player two then player one
win.

 Let P is a set of score obtained by Player1 and Player2


 The total of score will come out is represented by a function displayScore.
 Player one win represented by a function Player1Win.

In formal statement
∃ player ∈ Player∨∀ p ∈ P , p 1> p 2 → Player 1 Win , displayScore(Player 1 , Player 2)

5. If points accumulate by player two has highest than player one then player two
win.
 The total of score will come out is represented by a function displayScore.
 Player two win represented by a function Player2Win.

In formal statement
∃ player ∈ Player∨∀ p ∈ P , p 2> p 1 → Player 2Win , displayScore (Player 2 , Player 1)

6. If both players have the same points then the game is tie.
 The game tie represented by a function tie

In formal statement
∃ player ∈ Player∨∀ p ∈ P , p 1= p 2→ tie

14
4. Game Code

Coding of blackjack:

15
Coding of card:

16
Coding of deck:

17
18
Coding of suit:

Coding of value of card:

19
5. Conclusion
As a conclusion, through this project we are able to understand the concepts of
notations from discrete structure more. It is useful to be used for studying and describing
objects and problems in all branches of computer science. Through the concept of notation
and statements, we understand the logic and algorithm of our program which are helpful in
coding a program. We also learned to be systematic in complete a thing so that we can know
the needs and flaws for our programs.

Every game that looks simple on the surface may be difficult when one really tries to
understand the mechanism in it. Hence, we required different management approaches to
make sure the completion of this project is as perfect as possible. We have to provide a real
logic statement for it to work and make sure it does not end up with any errors. This helped us
in our logical thinking and thinking skills for making a near impossible task to be possible.

There are many things that we had learned through the process of completing this
project. The most important thing we learned is teamwork and work distribution. The
workload of each task is different and providing everyone the same workload is nearly
impossible. Therefore, we discuss our individual areas of interest and skills and divide the
tasks according to the skills of different group members. We make sure everyone understands
the goal of this project and discusses the game, date of submission and the way of our output
will be marked. Everyone gives their cooperation and puts much effort in this project.

Besides that, we learned to make planning and preparation. We discuss the plan of
what needs to be done, how it is done and the role of each group member. Then, we divide

20
the tasks so that there is a clear work path for all group members to understand their
responsibilities. We learned how to make an action by following the plan and working
towards the final deadline. Time management handled by every group member is also pitch
perfect for completing this project.

Furthermore, we learned the way of communication and handling problems with


people that have different personalities. We learned to understand and respect each other's
differences. We also helped each other to make sure everyone is at the same progress.

Last but not least, we would like to give our most beloved appreciation to Dr Wan
Nural Jawahir binti HJ Wan Yusoff for giving us the chance for doing this project. Through
this chance of working together, we had eventually strengthened the bond among the group
members and learned valuable lessons along the way.

21
6. References
Eck, D. J. (2015). Introduction to programming using Java: Programming Example: Card,
Hand, Deck. David J. Eck(Ver. 8.0). (227-236). Retrieved from
http://math.hws.edu/javanotes/index.html

National decks. (n.d.). Retrieved January 13, 2021, from


https://www.britannica.com/topic/playing-card/National-decks

22

You might also like