PokerTexasHoldem

Bobby Donald
Alex Chen
December 3, 2014

Overview

A poker game of Texas Hold'em where one player bets against 3 cpu players. Each player is dealt two cards and there is also five cards in the middle. Each player must make the best hand combination and bet that their hand is the best!

Screenshot

(You may attach a PNG, GIF, or JPG file. Please note the Attach: syntax for doing this. After you save the wiki page, you will see the Attach: link with a blue triangle. Click on the link, and then you will be brought to a page where you can upload the attachment. After you upload the attachment, the link goes away and you see the image instead.)

Concepts Demonstrated

1/6 of the project grade is based on which concepts from OPL are demonstrated in your project. Please identify them here. Be brief; a simple list and one-sentence explanation for each concept should be adequate; e.g.:

  • Lists, lambda are used to create and manipulate card objects and hands
  • Data abstraction is used to access and alter list elements and create a game
  • Recursion, lambda, cond/if, predicates (eqv?, eq?) are used to check to see if a certain hand condition exists
  • ''Objects are used for the gui elements, cards, and money

External Technology and Libraries

  • Racket/Card Library is used to create a deck and card objects each with suit and values.
  • GUI Library is used to create a Graphical User Interface to create a virtual card game.

Favorite Lines of Code

Each partner should identify a favorite line of code, Scheme expression, or entire procedure written by himself / herself in the entire project, and explain what it does. E.g.:

  • Bobby Donald:
    (send table add-cards your-hand 500 350 (lambda (i) (values (* i 80) 0)))
    

This is my favorite line of code. All it does is display your cards in a line on the screen. It takes initial values for x and y coordinates, (500, 350) and it calls the lambda function for each card with an increasing value for i, ex. 0, 1 ,2, 3. It then adds the new values to the initial values and puts the card at the coordinates. I like it because of how simple it is. It shows how useful it can be to pass a function as an argument.

  • Alex Chen:
    (define (has-pair? hd)
      (cond ((null? (cdr hd)) #f)
            ((= (send (car hd) get-value) (send (car(cdr hd)) get-value)) #t)
            (else (has-pair? (cdr hd)))))
      matches)
    

This block of code checks to see if a hand has a pair (two cards with the same value). It checks if the first card has the same value as the second and returns #t is it does. If not, it recursively calls itself to check the second card and the third card. It keeps recursing until either a pair is found or if there are no more cards to be compared.

Technology Used Block Diagram

Create a simple block diagram of your software system that illustrates the major technical components and how they interact. Indicate which partner did which part of the work by putting an individual's initials inside the component(s) for which that person was primarily responsible. E.g.:

Additional Remarks