Joker a Card Game Programming Language Jeffrey Eng Jonathan Tse Howard Chu Timothy SooHoo.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

Black Jack in Objective-C
Topics in Python Blackjack & TKinter
Java Coding 8 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. Object-Oriented Design Example - The.
It’s All in the Cards Adding and Subtracting Integers
Chapter 9 Interactive Multimedia Authoring with Flash Introduction to Programming 1.
MATLAB PROJECT DO YOU WANT TO PLAY A GAME?. DESIGN CRITERIA For this project, you are required to implement any card game using MATLAB  All selections.
Grouping objects Arrays and for loops. Fixed-size collections Sometimes the maximum collection size can be pre-determined. Programming languages usually.
Arrays. What is an array An array is used to store a collection of data It is a collection of variables of the same type.
By Dr. John Douglass. Erosion: Game Plan Conceptual basis for Erosion Conceptual diagram Overview Examples Rules Let’s Play!
Lecture 10. Simplified roulette European roulette has numbers 0,1,…36. xD0s
Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
Rules for Classroom Play. Setup 1. Remove blue ACTION cards from the Observatory deck 2. Shuffle both decks well and set Volcano deck to one side 3. Deal.
Logic Networks …and the card game Boolette
Card Counting What is it, how does it work, and can I use it to pay for college? (and if it does work, do I even have to go to college?) Jeff O’Connell.
Blackjack Programming Project
ECS15 sequence. Sequences  There are three kinds of sequences in Python: Strings – we use these a lot. “albatross” Lists – we saw those last time, they.
Chapter 6 - Repetition. Introduction u Many applications require certain operations to be carried out more than once. Such situations require repetition.
Intro to Java while loops pseudocode. 1 A “Loop” A simple but powerful mechanism for “making lots of things happen!” Performs a statement (or block) over.
CSE 115 Week 12 March 31 – April 4, Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
JAWS Space-Shooter Game Design Language Justin Lu Guoxin Andy Lin Winston Chao Shoaib Anwar.
Crème Anthony Chan Cheryl Lau James Leslie Joshua Mackler.
ECE122 L9: While loops March 1, 2007 ECE 122 Engineering Problem Solving with Java Lecture 9 While Loops.
A R R A Y ! for Multiplication!!
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
Black Jack Dr. Bernard Chen University of Central Arkansas Spring 2012.
Poker UML and ADT design plan.
Casinos There’s a reason they are big and extravagant!
Putting together a complete system Chapter 10. Overview  Design a modest but complete system  A collection of objects work together to solve a problem.
Guide to Programming with Python
Enabling Natural Interaction Randall Davis, Howard Shrobe Aaron Adler, Christine Alvarado, Mark Foltz, Tracy Hammond, Mike Oltmans, Metin Sezgin,Olga Veselova.
Repetition Statements.  Often it is necessary to repeat statements many times  Java has two ways of doing this  while statements  for statements.
Chapter 5 Loops. Overview u Loop Statement Syntax  Loop Statement Structure: while, for, do-while u Count-Controlled Loops u Nested Loops u Loop Testing.
CHAPTER 4 GC 101 Data types. DATA TYPES  For all data, assign a name (identifier) and a data type  Data type tells compiler:  How much memory to allocate.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
World Religions Tabulate Game. wild cards wild cards ordinary cards.
Comenius multilateral partnership European Multiguide Comenius Quiz This project has been funded with support from the European Commission. This.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Linked Structures - Review Chapter 13 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013.
November 28, 2005ICP: Chapter 9: Object Oriented Programming 1 Introduction to Computer Programming Chapter 9: Object Oriented Programming Michael Scherger.
Lesson thirteen Conditional Statement "if- else" ©
Comparing ArrayLists and Arrays. ArrayLists ArrayLists are one type of flexible-size collection classes supported by Java –ArrayLists increase and decrease.
Card Game Z  Agree on a dealer and a score keeper  The dealer should remove all the Jacks, Queens, Kings & Jokers from the pack and then shuffle  The.
Chapter 3. Control Structure C++ Programing. Conditional structure C++ programming language provides following types of decision making statements. Click.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Module 5: Programming with C#. Overview Using Arrays Using Collections Using Interfaces Using Exception Handling Using Delegates and Events.
Section 5.5 Application: The Card Game of War. 5.5 Application: The Card Game of War A deck of cards is shuffled and dealt to two players The players.
A game of precision, quick reaction and observation.
MIS Professor Sandvig MIS 324 Professor Sandvig
Lecture 11.
C# and the .NET Framework
Chapter 5: Programming with C#
Fundamentals of Programming I More Data Modeling
Engineering Innovation Center
A R R A Y ! for Multiplication!!
Essential Questions How do we use the Factor Theorem to determine factors of a polynomial? How do we factor the sum and difference of two cubes.
Truth tables: Ways to organize results of Boolean expressions.
Let’s Practice Play 2 Missing Digits !
Truth tables: Ways to organize results of Boolean expressions.
Collections Not in our text.
3rd/4th grade Family Math Night Games
Fundamentals of Programming I More Data Modeling
Truth tables: Ways to organize results of Boolean expressions.
Task 2 Implementation help
Chapter 8 Multidimensional Arrays
Vocab-Rummy A card game with: Could be used for:
General Condition Loop
Chap 7. Advanced Control Statements in Java
A R R A Y ! for Multiplication!!
Presentation transcript:

Joker a Card Game Programming Language Jeffrey Eng Jonathan Tse Howard Chu Timothy SooHoo

Motivation   Structure & rule-driven nature of card games   Succinctly describe the rules of a card game   Create a runtime card game engine   Framework for creating standard games

Feature Overview  Special Pack datatype and operators  Hierarchy declaration  Program structure  Java-like syntax

Compiler Architecture *. jkr LexerTree Walker Java Backend Classes DEALR Parser

Pack of Cards  Deck of cards is embedded in the language  known as the "pack" type.  essentially a super data structure with many list- like operations  In general, this is a grouping of cards. Can be used for the deck, player's hands, discard piles, etc.

Pack Operators  The value of these expressions is a reference to a new pack containing the removed cards or the newly combined cards.  theDeck >> 2// pop (or, deal)  theDeck << myHand// push  theDeck += disCards// enqueue  theDeck -= 5// back-pop (dequeue)  shuffle  myHand[0]// indexed access

War Example game War { init { init { pack theDeck; hierarchy : { A(14), K(13), Q(12), J(11), 10(10), 9(9), 8(8), 7(7), 6(6), 5(5), 4(4), 3(3), 2(2) } by { spades(1).hearts.clubs.diamonds } into theDeck; // shuffle the deck // give half the deck pack player1Hand = (theDeck >> theDeck.size/2); pack player1Hand = (theDeck >> theDeck.size/2); // give the other ones // give the other ones pack player2Hand = (theDeck >> theDeck.size); pack player2Hand = (theDeck >> theDeck.size); }

War Example (cont) main { for(int turn=0; true; turn++) { boolean isDone = false; boolean isDone = false; card oneCard, twoCard; card oneCard, twoCard; pack prize; pack prize; int winner; int winner; while(isDone != true) { while(isDone != true) { // IF they turn out of cards, other player is winner // IF they turn out of cards, other player is winner if( player1Hand.size < 1 ) { if( player1Hand.size < 1 ) { winner = 2; break; break; } else if ( player2Hand.size < 1 ) { else if ( player2Hand.size < 1 ) { winner = 1; break; }

War Example (cont) oneCard = (player1Hand >> 1)[0]; oneCard = (player1Hand >> 1)[0]; twoCard = (player2Hand >> 1)[0]; twoCard = (player2Hand >> 1)[0]; if(oneCard lt twoCard) { if(oneCard lt twoCard) { player1Hand += oneCard; player1Hand += twoCard; player1Hand += prize; isDone = true; } else if(oneCard gt twoCard) { else if(oneCard gt twoCard) { player2Hand += oneCard; player2Hand += twoCard; player2Hand += prize; isDone = true; }

War Example (cont) else { // IF they turn out of cards, other player is winner if( player1Hand.size < 4 ) { winner = 2; break; break;} else if ( player2Hand.size < 4 ) { winner = 1; break;} // I declare war prize += oneCard; prize += twoCard; prize += player1Hand >> 3; prize += player2Hand >> 3; } }} print "The winner is "; print winner; }}

Blackjack Example game Blackjack { init { int numPlayers = 4; pack DECK; pack [ numPlayers ] playerHands; } main { boolean flipMe = true; for (int n = 1; n < = 2; n++) { foreach playerHands as hand{ hand += (DECK >> 1); hand.private = flipMe; } flipMe = false;

Blackjack Example (cont) foreach playerHands as hand { while(true) { int sum = 0; foreach hand as card { sum += card.value; } option (hand) hit (sum <= 21) {…} stand (sum <= 21) {…} bust (sum > 21) {…} }}

Lessons Learned  Communication  Divide and conquer  Project schedule / milestones  Set realistic goals  Start early  Stay focused on the core objectives