Next Final Report Ernesto Arreguin eja2124 Danny Park dsp2120 Morgan Ulinski mu2189 Xiaowei Zhang xz2242 1 Contents 1 Introduction 1 1 Language Elements 3 4 2 Language Tutorial 2 1 Tutorial 1 2 2 Compiling and Running a Next Program 2 3 Tutorial 2 5 5 7 8 3 Language Manual 3 1 Lexicon 3 1 1 Character Set 3 1 2 Identifiers 3 1 3 Comments 3 1 4 Keywords 3 1 5 Operators 3 1 6 Punctuators 3 1 7 String and integer literals 3 2 Basic Concepts 3 2 1 Blocks and Compound Statements 3 2 2 Scope 3 3 Side E ects and Sequence Points 3 4 Data Types 3 5 Declarations 3 5 1 Primitive Types 3 5 2 Complex Types 3 6 Expressions and Operators 3 6 1 Primary Expressions 3 6 2 Overview of the Next Operators 3 6 3 Unary Operators 3 6 4 Binary Operators 3 6 5 Assignment Operator 3 7 Statements 3 7 1 Labeled Statements 3 7 2 Compound Statements 3 7 3 Expression Statements 3 7 4 Selection Statements 2 13 13 13 13 14 14 15 15 15 16 16 17 17 17 18 18 18 19 19 20 21 23 25 26 26 26 26 27 3 8 3 9 3 7 5 Gameplay Statements 29 Start Statements 30 Example Program 31 4 Project Plan 4 1 Process 4 2 Programming Style Guide 4 2 1 Width of the page 4 2 2 Height of the page 4 2 3 Using tab stops 4 2 4 Comments 4 2 5 Indentation 4 3 Project timeline 4 4 Roles and Responsibilities 4 5 Software Development Environment 32 32 33 33 33 33 33 33 34 34 35 5 Architectural Design 35 5 1 Architecture Block Diagram 35 5 2 Interfaces Description 37 6 Test Plan 7 Lessons Learned 7 1 Ernesto 7 2 Danny 7 3 Morgan 7 4 Xiaowei 37 8 Appendix 1 39 39 41 41 42 42 Introduction The Next programming language provides a way to easily create text based computer games Users of the language can specify characters locations and items that will appear in the game and they can design the general plot of the game that ties these together This language is ideal for creating text based RPGs or digital choose your own adventure stories 3 1 1 Language Elements Declarations The program is primarily structured around declarations The user will create declarations for characters locations items and attributes Items Items are objects that the game player can pick up and maintain in their inventory and which can be contained in locations The player could be required to collect item or he might need a certain item to perform certain actions Characters Characters can appear in locations throughout the game A declaration for a character will provide the character s name items he holds and attribute values Locations Locations provide a basic map of the game s landscape These are the rooms in which a game player can find characters to interact with items to pick up or options for actions For each location in the game there are two types of declarations It has a regular declaration similar to a character declaration in which its name is declared as well as items found in that location characters found in that location and attributes of the location Each location also mandatorily has an associated start statement which defines what gameplay will take place in that location This start statement can contain any of the allowable statements in the language Actions The way a player can interact with the game to make choices regarding gameplay is by selecting from various actions The programmer defines a list of possible actions and the code that will be executed when each action is chosen This is what allows the players to control the plot of the game 4 Randomness A key element of a language designed to create games is some element of randomness so the gameplay will not be entirely predictable This is implemented in our language through probability statements a form of selection statement in which each option is assigned a probability and the option to be executed is chosen according to what number is returned by a random number generator Basic Math Our language provides the tools for performing basic math such as addition subtraction and boolean operations These can be used to declare additional variables update the values of attributes examining features of attributes for conditional results for actions or anything else the programmer can think of to make use of them 2 2 1 Language Tutorial Tutorial 1 In this section we will create a simple program in the Next programming language that outputs Hello world Keep in mind that in this step by step each line individually explained is part of a single program The Next programming language can be thought of as a language made up of declarations A programmer can declare a number or a string We will begin by declaring an integer and setting its value to 0 int num 0 We will then declare a string string announce Not in the world In Next we can also declare items characters and locations Here we will declare a character and a location What follows is a character declaration The first parenthesis contains the characters attributes while the second contains the items the character is carrying We will leave the second parenthesis empty because our character is not carrying anything 5 character you string slogan Hello world What follows is a location declaration The first parenthesis contains the locations attributes the second contains the items the location contains and the third the characters the location contains We will leave the first two empty and only include a character in the location declaration This code looks as follows location here you There is a special type of declaration in next in which we declare an event to start Once a location has been declared a start declaration must be made for that location In order to use a location in conjunction with a start statement the location must be declared first In order to use a character in a location that character must be declared first In order to use an item in a character or a location the item must be declared first This is why in the Next language it is a good programming practice to create all of the item character and location declarations first and in that order followed by the start declarations The start declarations must contain the programming logic for each location because aside from other declarations Next does not allow statements to be placed outside of a start declaration The start location we will use for this program looks as follows start here end num 1 if exists here you then output you slogan else output announce num 1 This start declaration starts the here location and specifies that it will end when integer num is equal to 1 The expression if exist
View Full Document
Unlocking...