Professional Documents
Culture Documents
on
CARDS GAME
INDUSTRIAL TRAINING PROJECT REPORT
Submitted in partial fulfillment of the requirements for the award of the degree
of
BACHELOR OF TECHNOLOGY
in
INFORMATION TECHNOLOGY
by
PRATHAM KAKKAR
Enrollment No: 09115603120
to
MS. NEETU SWAROOP
In this CARD GAME, each player draws a card from the deck and
the player with the highest card wins. I’m going to build this card
game by defining classes representing a card, a deck, a player and
finally the game itself.
Description of functions:
I would also like to thank Ms. Neetu Swaroop, for giving me the opportunity
to work on this project.
TABLE OF CONTENTS
ABSTRACT Iii
ACKNOWLEDGEMENT Iv
TABLE OF CONTENTS V
LIST OF FIGURES Vii
3.1. Steps
3.2. Libraries Used
5.1 Conclusions
5.2 Future Scope
LIST OF FIGURES
1. Certificate
2. Card Game
3. Methodology
4. Snapshots of project
CHAPTER 1: INTRODUCTION
1. Introduction
Python is an interpreted high-level general-purpose
programming language. Its design philosophy emphasizes code
readability with its use of significant indentation.
Its language constructs as well as its object-oriented approach
aim to help programmers write clear, logical code for small and
large-scale projects. Python is dynamically-typed and garbage-
collected.
1.2. History :-
This card game is made with Python. In this card game, each
player draws a card from the deck and the player with the highest
card wins. I’m going to build this card game by defining classes
representing a card, a deck, a player and finally the game itself.
2.2 Objective
This card game is created using the concept of playing cards. the
computer designates player one and player two and the computer
asked them to enter a random value and then the computer
chooses two cards and tells the player who has the bigger card
sequence. The person who has bigger card sequence wins the
round. The computer then analyses the winner of each round and
tells the winner of the game.
2.3. Gameplay
Just like the concept of a card game where the bigger card sequence
wins the game. In this game also, the computer chooses to random
cards for the players. The player with the bigger card sequence wins.
2.4. Strategy
The strategy in a regular card game is totally luck dependent. If you get
the higher card from the deck which includes suits and numbers of each
card. Suits is a tuple of strings representing all the suits a card can be:
spades, hearts, diamonds, clubs.The cards in each suit are labelled from
2-10 and the jack, the queen, the king and the ace. The ace is of highest
value in the cards. If someone gets an ace of diamonds and the other
player gets a 9 of clubs, the player with the ace of diamonds wins the
game.
Create a interface which asks for the name of player 1 and player
2.
Creating classes of –
1) Card
2) A deck
3) The player
4) The game itself
Allow the player to enter a random key from which the computer
chooses the cards for each player.
Display the message, who won the match.
3.2. Libraries used:
Tkinter
Card objects have two instance variables: suit and value, each
represented by an integer. Together, the instance variables
represent the card type of the Card object. For example, you create
a 2 of hearts by creating a Card object and passing it the
parameters 2 (for color) and 1.
THINGS TO REMEMBER :
The code for these magic methods can also handle whether the cards
have the same value, for example, if both cards have a value of 10. If
this happens, the methods use the value of the combinations to break the
tie.
When you initialize the Deck object, the two for loops of __init__ create
Card objects representing all the cards in a 52-card deck and add them to
the card list. The first loop goes from 2 to 15 because the first value of a
card is 2 and the last value of a card is 14 (the ace).
Each time around the inner loop, a new card is created using the integer
from the outer loop as the value (i.e. 14 for an ace) and the integer from
the inner loop as the suit. This process creates 52 cards – one card for
each combination of suit and value.
After the method creates the cards, the shuffle method of the shuffle
module randomly rearranges the items in the card list; imitating the
shuffle of a deck of cards.
Our deck has another method called rm_card which removes and returns
a card from the card list, or returns None if it is empty.
The Player class has three instance variables: wins to keep track of the
number of turns a player has won, card to represent the card a player
currently holds, and name to keep track of a player’s name.
When you create the game object, Python calls the __init__ method and
the input function collects the names of the two players in the game and
stores them in the variables name1 and name2.
Then you create a new Deck object, store it in the instance variable deck,
and create two Player objects using the names in name1 and name2. The
play_game method of the Game class starts the game. There is a loop in
the method that maintains the game as long as there are two or
morecards left in the deck, and as long as the variable response is not
equal to q .
On each loop turn, you assign the variable response to user input. The
game continues until the user types “q” or when there are less than two
cards left in the deck. Two cards are drawn each time in the loop and the
play_game method assigns the first card to p1 and the second card to p2.
Then he prints each player’s name and the card he drew, compares the
two cards to see which card is the bigger one, increments the wins
instance variable for the player with the highest card, and prints a
message indicating who won. The Game class also has a method called
winning which takes two player items, looks at the number of tricks
they’ve won, and returns the player who has won the most tricks.
When the Deck object runs out of cards, the play_game method displays
a message that the war is over, calls the winning method (passing both
p1 and p2), and displays a message with the result – player name who
won.
CHAPTER 4 : RESULT ANALYSIS
5.1 Conclusion:
After so much effort put in, I successfully created a dynamic and responsive
card game.
CODING NINJAS
Parikh Sir
Ankur Sir
Without them, this project and this report would not have been possible.
The gaming industry has sparked tremendous interest in recent years. With
several companies investing millions of dollars in developing new and
innovative games, the gaming industry has stepped on a steep growth curve.
It is forecasted that the gaming industry will generate great opportunities for
game developers over the next two years. The gaming industry has grown
its presence over various platforms – mobile, console, PC, online gaming
and the industry is growing really fast along with the presence on all these
platforms. Most of the other sectors stick to only one platform and then
move to the another, once they have established their presence on the same.
However the ‘Gaming Industry’ has a different story to tell.