BOREDGAMES Language for Board Games

Similar documents
BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

BoredGames Final Report A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

Tic Tac Toe Game! Day 8

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s

Senet. Language Reference Manual. 26 th October Lilia Nikolova Maxim Sigalov Dhruvkumar Motwani Srihari Sridhar Richard Muñoz

Two Dimensional Arrays

JME Language Reference Manual

tiler. Language Description:

2D Array Practice. Lecture 26

CS 314 Exam 2 Spring

GridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof.

Loops and Conditionals. HORT Lecture 11 Instructor: Kranthi Varala

Java Loop Control. Programming languages provide various control structures that allow for more complicated execution paths.

Lecture 10: for, do, and switch

Question 1 [20 points]

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS159 Midterm #1 Review

IT115: Introduction to Java Programming 1. IT115: Introduction to Java Programming. Tic Tac Toe Application. Trina VanderLouw

Last Time: Rolling a Weighted Die

CS201 - Assignment 3, Part 2 Due: Wednesday March 5, at the beginning of class

GridLang: Grid Based Game Development Language. Programming Language and Translators - Spring 2017 Prof. Stephen Edwards

Review Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous

Lab Activity #7 2D Arrays and File Streams

VLC : Language Reference Manual

Long Questions. 7. How does union help in storing the values? How it differs from structure?

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Introduction to the Java Basics: Control Flow Statements


Twister: Language Reference Manual

Learning objec-ves. Declaring and ini-alizing 2D arrays. Prin-ng 2D arrays. Using 2D arrays Decomposi-on of a solu-on into objects and methods

The Warhol Language Reference Manual

Today in CS161. Lecture #12 Arrays. Learning about arrays. Examples. Graphical. Being able to store more than one item using a variable

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 4 Certificate in IT SOFTWARE DEVELOPMENT

Advanced Computer Programming

Python Games. Session 1 By Declan Fox

GBL Language Reference Manual

Declaring and ini,alizing 2D arrays

1 Undirected Vertex Geography UVG

AP Computer Science Lists The Array type

Introduction to Programming Using Java (98-388)

UNIT-I Fundamental Notations

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Lecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

COMP-202: Foundations of Programming. Lecture 3: Boolean, Mathematical Expressions, and Flow Control Sandeep Manjanna, Summer 2015

D - Tic Tac Toe. Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9

Accelerating Information Technology Innovation

CS12020 for CGVG. Practical 2. Jim Finnis

Lesson 7A Arrays. By John B. Owen All rights reserved 2011, revised 2014

Java. Programming: Chapter Objectives. Why Is Repetition Needed? Chapter 5: Control Structures II. Program Design Including Data Structures

Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

RTL Reference 1. JVM. 2. Lexical Conventions

ENGR 1181 MATLAB 09: For Loops 2

CS61B Lecture #35. [The Lecture #32 notes covered lectures #33 and #34.] Today: Enumerated types, backtracking searches, game trees.

PLT Fall Shoo. Language Reference Manual

Ensuring a Rigorous Curriculum: Practices and Goals

Lecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

HUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK

Haskell Refresher Informatics 2D

PROGRAMMING FUNDAMENTALS

Operators. Java operators are classified into three categories:

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

DECISION CONTROL AND LOOPING STATEMENTS

XVIII Open Cup named after E.V. Pankratiev Stage 1: Grand Prix of Romania, Sunday, September 17, 2017

Loops (while and for)

easel LANGUAGE REFERENCE MANUAL

And Parallelism. Parallelism in Prolog. OR Parallelism

Chapter 2 Working with Data Types and Operators

C++ Programming: From Problem Analysis to Program Design, Fourth Edition. Chapter 5: Control Structures II (Repetition)

Instructor: SIR MUHAMMAD NAVEED Created by: ARSLAN AHMED SHAAD ( ) MUHAMMAD BILAL ( ) ISIT:

CSci 1113 Lab Exercise 6 (Week 7): Arrays & Strings

Session 8.2. Finding Winners Using Arrays

ASML Language Reference Manual

1. What type of error produces incorrect results but does not prevent the program from running? a. syntax b. logic c. grammatical d.

Java Outline (Upto Exam 2)

Chapter 12: Arrays Think Java: How to Think Like a Computer Scientist by Allen B. Downey

SCoLang - Language Reference Manual

Introduction to: Computers & Programming: Review prior to 1 st Midterm

- If you want to repeat the same blocks of code over and over you have two choices. Copy

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

More Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

Prime Time (Factors and Multiples)

Lecture 6. Assignments. Summary - Variables. Summary Program Parts 1/29/18. Reading: 3.1, 3.2, 3.3, 3.4

CSC Java Programming, Fall Java Data Types and Control Constructs

20 th South African Regional International Collegiate Programming Contest

C/C++ Programming Lecture 7 Name:

Announcements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop

(Python) Chapter 3: Repetition

CS1 Studio Project: Connect Four

5. Control Statements

Chapter 3: Arrays and More C Functionality

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #06 Loops: Operators

Sprite an animation manipulation language Language Reference Manual

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

ECE15: Lab #4. Problem 1. University of California San Diego

8. Control statements

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

Transcription:

BOREDGAMES Language for Board Games I. Team: Rujuta Karkhanis (rnk2112) Brandon Kessler (bpk2107) Kristen Wise (kew2132) II. Language Description: BoredGames is a language designed for easy implementation of turn-based board games. BoredGames will enable users to quickly and efficiently setup a board, establish rules for the game, and define how each turn should be played. All three of these tasks are split into different sections, which will be integrated together by our complier. BoredGames aims to be generic enough to cover a wide range of board compositions, accessories, and rules. III. Problems That We Can Solve: Traditionally developing board games in languages such as C++ or Java is a very time consuming task. A great deal of setup is required and many dependencies need to be dealt with before the rules of the game can even start to be coded. Additionally, much of the code is not reusable from one game to another. BoredGames aims to fix these problems by providing the tools to quickly develop game boards, pieces, and players without the need to deal with the many intricacies that normally go along with these tasks so that the developer can jump right into defining the rules and procedures of the game. This simplified process also allows the user to easily make changes in the game without altering much of the code. We also will allow the user to easily traverse the board and make changes. Board games are often very complicated to create on a computer and we aim to simplify this process as much as possible while still providing the ability for users to develop a wide range of games through the powerful and diverse set of tools within our language. Some simple games that can be implemented in BoardGames include Tic- Tac-Toe, Checkers, Chess, and Monopoly. IV: Language Use and Syntax: A. General Structure:

The general structure of every program in our language is as follows: Setup{ /* General setup such as board, pieces and players goes here*/ Rules{ /* the rules of the game go here. Examples of this are invalid move checks and win condition checks.*/ Play{ /* How a player s turn should proceed from start to end goes here*/ In addition to following the above structure, each program in our language has a few requirements. Every line of the program must end in a semi-colon. Also, comments can be written only in the following format: /* Comment Goes here */. Another detail about our language is that all counting in the language starts at one. Finally, to escape characters place them inside a pair of single quotes. B. Types and Tools: The following primitive data types exist in our language: boolean which can be true or false, double which is used for decimal numbers, int which is used to store integers, and String which must be surrounded by double quotes. Along with these primitive types we also have a matrix type which is a standard two dimensional matrix and should be mainly used for storing piece move-sets and the coord type which stores coordinate pairs. We also have a few different tools available to the programmer which should make designing a board game very simple. The first tool is Board which, as its name would suggest, is the game board on which all moves and piece placements will be based on. Board contains the ability to check if a specific tile on the board is unoccupied and also the ability to provide the contents of a specific tile. A Board is required in each game. Our second tool is Players which is where the programmer places all information about the players in the game. Each Player can have a name, an inventory, and a point value, but only the name is required. At least one player is required in every game. The next tool is Pieces. Pieces allows the developer to create game pieces that can be either placed on the board or directly into a particular player s inventory. Pieces have names and optional point values, movesets and owners. Pieces are not required in a game. Other tools include input, which takes keyboard input from the program s user, and output which displays the current board to the program s user. The final tools are Dice, Timer, and EndGame. Dice rolls a die with a specified amount of sides, Timer is an ascending or descending countdown, and EndGame ends the game, displays the board and displays a message to the users. C. Operators: All of the following operators are defined in our language with the same functionality they have in most standard languages. is used for the logical or, && is used for the logical and, = is for

assignment, + is for addition and the concatenation of strings, - is for subtraction, * and / are for multiplication and division respectively, % is for the modulo operation, and! is the logical not operation. We also have the following comparison operators: < is the less-than operator, > is the greater-than operator, == is the equality operator where equality is checked by value, <= is the less-than or equal-to operator, >= is the greater-than or equal-to operator, and!= is the not equal to operator. D. Program Control Flow: In addition to the above we provide the following tools for program control: if and else statements, which behave as they do in other languages. The if statement must evaluate to true or false, the else is not required. If-else is not part of our language. The if and else statements syntax is as follows: if(boolean Statement){ /* code here*/ else{ /*code here*/ We also have a loop that can be used to repeat lines of code. There are two different types of loops in our language. The first takes a boolean statement and continues as long as the statement is true. The syntax is as follows: loop(boolean statement){ /* code here*/ The second takes a start and an end number and iterates through the loop end number start number + 1 times. The syntax of this is as follows: loop(start number:end number){ /* code here */ In addition to using the start number:end number format for loops this format when describing coordinates of the Board. E. Setup Section: Now we will look at what occurs in each section of a program in our language. First we will look at the setup section. Since we are a board game language, we require the developer to define the size of the board using the following syntax: Board(Number of Rows, Number of Columns);

This should be the first line in the setup section of the program. Next users should define the players by creating players using syntax such as: Players.add(Player Name, Point Value *Optional*); Once the players have been created, pieces can be added into the player s inventory or onto the board directly. Adding into a specific player s inventory can be done by using the following syntax: Pieces.add(Player Name, Piece Name, Quantity of Piece); Adding a piece onto the board can be done using the following: Pieces.add(Player Name, Piece Name, Quantity Of Piece, Board Row, Board Column); A set of valid moves can also be added to a piece using the following syntax: Pieces.add(Player Name, Piece Name, Quantity Of Piece, Board Row, Board Column, Moves); Where Moves is a matrix where each row is sequence of valid moves that can occur on a single turn. Each element of the matrix must be from the following set {up, down, left, right, diagleftup, diagleftdown, diagrightup, diagrightdown. An example of a move matrix for a knight in chess would be the following: Any move made by a user during runtime is automatically checked against the move matrix to make sure the move is valid. F. Rules Section: The Rules section of each program contains a set of rules that the programmer can check against during runtime to make sure the game proceeds normally. There need not be any rules defined in a game, but most games will at least require a rule for winning/losing. Each individual rule is essentially a function that can only return true or false. Every rule must start out in the following manner:

rule rulename: /* rule goes here */ ; An example of a completed rule that checks if the tiles located at spot 1,1 on the board is unoccupied is: rule r1: Board(1,1).unoccupied(); An important detail about rules is that they can only refer to other rules which are defined above them. Referring to rules defined below them will generate an error. A rule can be referred to by just using their names as if they were a boolean. The following code would then be valid in the play section if the example rule above is defined: if(r1){ EndGame( Board Spot 1,1 is empty. Game Over ); G. Play Section: The Play section of the program is where the game procedure for each player s turn is defined. The language automatically keeps track of which player is currently taking a turn, and a reference to Player in the Play or Rules section accesses this player. After all the code in the Play section has been executed, the program calls Play again for the next Player s turn. This is why the NextPlayer (syntax is just NextPlayer;) command exists. NextPlayer automatically adjusts the current Player according to the order in which Players were initialized in the setup section. This gives the program writer the power to create situations in which a player gets to take multiple turns in a row, such as when rolling doubles in Monopoly, or a player s turn is skipped. The only way for Play to exit is for the EndGame command to be called. Upon its execution, the game is over and the program ends. EndGame s Syntax is as follows: EndGame(Message To Send); V. Code For Tic-Tac-Toe: Setup{ Board(3,3); /* defines a 3x3 board */ Player.add( A ); /* add a player; owner is A */ Pieces.add( A, X,6)); /* owner A has 6 X pieces */ Player.add( B ); /* add a player; owner is B */ Pieces.add( B, O,6)); /* owner B has 6 O pieces */ Rules{ /* bounds check */ /* check left and right bounds */ rule r1: if(in.x < 3 && in.x > 0) {

; /* check top and bottom bounds */ rule r2: if(in.y < 3 && in.y > 0) { ; /*check if both bounds conditions are satisfied*/ rule r3: if(r1 && r2) { ; /* check if a tile is unoccupied */ rule r4: Board(in.x,in.y).unoccupied();; /* check if the board is full */ rule r5: int i = 1; int j = 1; boolean full = true; loop (i<4) { loop (j<4) { if (Board(i,j).unoccupied()) { full = false; j = j+1; i = i+1; return full;; /* win conditions */ /* horizontal win check*/ rule r6: int i = 1; int j = 1; int val = 0; boolean win = false; /* every row */ loop (i<4) { /* every col */ loop (j<4) { /* checks if the owner of the first piece on the board at i,j is owned by the current Player*/ if (Board(i,j).Pieces(1).owner == Player ) { val = val+1; j = j+1;

if (val==3) { win = true; val = 0; i = i+1; return win;; /* vertical win check*/ rule r7: int i = 1; int j = 1; boolean winchance; /* every column */ loop (i < 4){ winchance = true; /*every row*/ loop (j < 4) { /* checks if the first piece on the board at j,i has the same name as the first piece in the current player's inventory */ if (winchance == true && Board(j, i).pieces(1).name()!= Player.inventory(1).name()) { winchance = false; j = j + 1; if (winchance == true) { i = i + 1; ; /* diagonal win */ rule r8: int i=1; int a=0; /* goes through each row */ loop(1:3) { /* checks if the first piece on the board at location i,j has the same name as the first piece in the current player's inventory */ if (Board(i,i).Pieces(1).name == Player.inventory(1).name()) { a = a+1; i = i + 1; if (a==3) { ; /* checks if any of the three win contions are satisfied */

Play{ rule r9: if(r6 r7 r8) { ; /* displays the current board on the screen */ output(board); /* takes keyboard input from the user and stores it in the coordinate in */ input(coord in); if(r3){ Board.add(Player.inventory(1), in); if(r9){ /* break, display board and output message */ endgame( Player + player.owner + Won ); else{ if(r6){ /* break, display board and output message*/ EndGame( Board Full! No Winner! ); NextPlayer;