Git Product home page Git Product logo

bridge-game's Introduction

Bridge-Game

Play a game of Contract Bridge using this java application. Utilizes the ACBL Standard American Yellow Card guidelines for bidding.

Basics of Contract Bridge

Contract Bridge is a card game play with 4 people, each positioned at different corners of the table. Partnerships are formed from players sitting opposite of each other, North-South and East-West. The game is comprised of two parts: The bidding phase and the playing phase.

The Bidding Phase

The first phase of bridge begins when each player is dealt a hand of 13 cards each. Based on the composition of their hands, players will "bid" in a clockwise manor, creating what is known as a "contract". A contract is comprised of 2 parts: The level and the strain. In contract bridge, the goal is to for the partners who made the resultant contract to make the amount of "tricks" they said they could make. The number of tricks is determined by adding the contract level and six. Thus, contract levels range from 1 to 7 (7+6=13), the maximum number of tricks that can be made). The strain, also known as a "trump suit", can be either club, diamond, heart, spade, or No Trump. This variable is also determined by hand composition.

In this phase, you can either call a contract or "pass", which means the player is satisfied with the current contract. Once three players have passed in a row, the playing phase may begin. The bidding convention used in this program is the Standard American Yellow Card (SAYC) system. While other calls during the bidding phase, such as penalties and doubles, we do not uses these conventions for simplicity sake.

The Playing Phase

In the seocnd phase, the player left of the declarer (the player who first bid the strain of the contract) begins the first trick. The person who played the contract on the attacking side also plays their partner's hand, who displays their hand by suit once their turn has arrived during the first trick. They are what's known as the "dummy". The first card in a trick is the set suit for that trick. A player must play a card of that suit if they have one in their possesion. The player with the highest card of that suite during the round wins the trick.

The contracts, though, also contain the previously mentioned trump suit. If a player does not have a card that is currently being played, but does have a card with the given trump suit, when played, that card "trumps" all other cards other than that suit, depsite it's value.

Once all tricks have been completed, the amount of tricks the partners on the attacking side made are then reduced by adding the contract level and six, then subtracting that value from the number of tricks committed.

This is by no means a comprehensive description, but should provide a basic understanding of the game's flow.

Using the program

This game utilizies the command prompt for user input and game display. The game will first generate a hand for the user, and then ask them for a contract. The user continues to bid until three consecutive passes are made (AI bids are displayed as well). Afterwards, the game enters the playing phase. Here, the player chooses a card from their hand via numberpad to play for a given trick. The AI will display their cards for each trick, similar to how they showed their bids. Once all thirteen tricks have been completed, a score is calculated for the attacker (negative # for amount of tricks below contract, positive # for amount of tricks above contract). Lastly, the program asks if the user would like to play again.

Inputs for the program

Bidding Phase

Levels: 1 2 3 4 5 6 7

Strains: C = Club D = Diamond H = Heart S = Spade T = No Trump

Playing Phase

The number under each card displayed

Additional Comments

If you are compiling in Eclipse and have trouble viewing the suit symbols, do the following: Window->Preferences->General->Workspace->Text file encoding->Change to UTF-8

bridge-game's People

Contributors

xemnaes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

bsalita

bridge-game's Issues

GameOutput class type conversion bug

Hi, thank you so much for this program. I don't know if you even care to fix this, but there is a bug in your GameOutput class. You declared the local variable suit of type char, and initialize it as a type Suits object. I moved getCharVal() from the Cards class into the Suits class to fix this, and now it runs fine. I enjoyed your game a lot, so thanks again. Such a good practice program for contract bridge.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.