Unformatted text preview:

AIC All In the Cards Final Report COMS 4115 Programming Languages and Translators AIC is a language that allows the easy creation of card games ranging from the well known to brand new user created Andrew Willouer asw2126 8 10 2009 AIC All In the Cards Final Report Aug 10 Contents 1 Introduction 4 1 1 Goals of AIC Intuitive Ease of Use 4 2 Language Tutorial 4 2 1 Introduction 4 2 2 Example 4 3 Language Reference Manual 6 3 1 Lexical Conventions 6 3 1 1 Comments 6 3 1 2 Identifiers Names 6 3 1 3 Keywords 6 3 1 4 Integer Constants 6 3 1 5 String Constants 6 3 1 6 Operators 6 3 1 7 Conditional Statements 7 3 1 8 Iteration Statements 7 3 2 Data Types 7 3 2 1 Arrays 7 3 3 Scope 8 3 4 Declarations 8 3 4 1 Variables 8 3 4 2 Functions 8 3 4 2 1 Predefined Functions 8 4 Project Plan 8 4 1 Team Roles and Responsibilities 8 4 2 Project Timeline 9 4 3 Planning and Specification 9 4 4 Development and Testing 9 4 5 Programming Style Guide 9 4 6 Software Development Environment 10 4 7 Project Log 10 5 Architecture Design 11 Andrew Willouer asw2126 2 AIC All In the Cards Final Report Aug 10 5 1 Block Diagram 11 6 Test Plan 12 6 1 Automated Testing 12 6 2 Non Automated Testing 12 7 Lessons Learned 12 8 References 13 9 Appendix 13 9 1 AOC ml 13 9 2 AST ml 13 9 3 Scanner mll 14 9 4 Parser mly 17 9 5 Printer ml 19 9 6 Interpret ml 21 9 7 MakeFile 27 9 8 Test Script Test bat 27 9 9 test arith1 mc 28 9 10 test arith2 mc 28 9 11 test fib mc 28 9 12 test for1 mc 28 9 13 test func1 mc 29 9 14 test gcd mc 29 9 15 test hello mc 29 9 16 test if1 mc 29 9 17 test if2 mc 29 9 18 test if3 mc 30 9 19 test if4 mc 30 9 20 test ops1 mc 30 9 21 test var1 mc 30 9 23 test while1 mc 30 9 23 blackjack txt 31 9 23 highcard txt 33 Andrew Willouer asw2126 3 AIC All In the Cards Final Report Aug 10 1 Introduction There are thousands of card games that use a standard 52 card deck AIC allows the quick creation of card games by only specifying certain parameters AIC language describes the rules players dealer number of decks and card values and the AIC compiler takes this input and creates a console based card game This allows the user to concentrate on the rules of the game and not worrying about the coding details 1 1 Goals of AIC Intuitive Ease of Use The main goal of AIC is to allow the game designer to easily create various card games with only having basic programming skills This will allow the game designer to concentrate on game creation instead of the programming syntax 2 Language Tutorial 2 1 Introduction The AIC language is based off of C and Java and should be familiar to anyone who has programmed in those languages The AIC language is an interpreter language Once the language is compiled it can be run on Windows as an exe from the command prompt and takes a text file as input The text file is based off of the AIC language 2 2 Example An AIC program starts with the main function The AIC language supports global and local variables and functions Below is partial code from an example of a High Card game Cards are taken from the deck and whoever has the highest card wins There are built in functions to the AIC language to speed up programming The Deal function takes one card off of the deck and gives it to the player who is passed to the function The deck is already initialized upon start up but it can be changed if needed The Read function takes input from the command line and assigns it to a variable Print prints out a variable to the command line AIC language also supports comparing player variables which actually compares the value of the player s hands The card values can be changed to give different cards different values This main var var var var var var var var var var var is the starting point of the function NDecks Dealer numplayers CName dealer player1 player2 player3 i pvalue dvalue Andrew Willouer asw2126 4 AIC All In the Cards Final Report Aug 10 var anothercard var bust NDecks 1 Dealer true CName HighCard Print out what card game Print You are playing Print CName Print How many players are playing Enter a number between 1 and 3 Read numplayers while numplayers 1 numplayers 3 Print Wrong number of players How many players are playing Enter a number between 1 and 5 Read numplayers Shuffle Deck Shuffle isn t implemented yet Deal dealer This will take the top card from the deck and add it to the dealer s hand Print The dealer s card is Print dealer Deal player1 Print Player one s card is Print player1 if dealer player1 Print dealer wins else Print player one wins The output from running this little code would be You are playing HighCard How many players are playing Enter a number between 1 and 3 Program waiting for input User enters 1 The dealer s card is Prints the dealer s card example 4H Andrew Willouer asw2126 5 AIC All In the Cards Final Report Aug 10 Player one s card is Prints the player s card example 6D Player one wins 3 Language Reference Manual 3 1 Lexical Conventions There are six kinds of tokens in the AIC language identifiers keywords constants strings expression operators and other separators Blanks tabs newlines spaces and comments whitespace are ignored except to separate tokens Some whitespace is required to separate adjacent tokens 3 1 1 Comments Comments start with and end with Everything between those symbols is considered part of the comment Comments do not nest 3 1 2 Identifiers Names An identifier is a sequence of letters a z digits 0 9 and underscores and the first character must be a letter Upper and lower case letters are distinct and there is no limit on the length of an identifier Keywords are reserved and cannot be redefined 3 1 3 Keywords The following identifiers are reserved for keywords If Shuffle else while for return int Read value var bool true false main Print Cards Deal Also all the card names are reserved 2 10 J Q K followed by S H C D Example 2S for 2 of Spades or KH for King of Hearts 3 1 4 Integer Constants An integer constant is a sequence of digits 0 9 and always considered to be decimal 3 1 5 String Constants A string is a sequence of one or more characters which may include letters …


View Full Document

Columbia COMS W4115 - All In the Cards

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Loading Unlocking...
Login

Join to view All In the Cards and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view All In the Cards and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?