Unformatted text preview:

C LOG Project Final Report An Entity Interaction Simulation Language John Demme jdd2127 Nishant Shah nrs2127 Devesh Dedhia ddd2121 Cheng Cheng cc2999 Columbia University December 18 2008 Contents 1 Introduction C LOG 3 1 1 Application Features 3 1 2 Goals 4 2 Tutorial 4 2 1 Variables 4 2 2 Statements 5 2 3 Facts 5 2 4 Rules 5 2 5 Directives 6 2 6 Simulator 6 2 7 Program Modification 8 2 8 Breakout 9 3 Language Reference Manual 10 3 1 Lexical 10 3 2 Facts 10 3 3 Rules 11 3 4 Variables 11 3 5 Blocks 11 3 6 Statements 12 3 7 Comparisons 13 3 8 Types 13 3 9 Directives 13 3 10 Program Modification 14 3 11 Interaction The Dot Operator 14 4 Project Plan 14 4 1 Responsibilities 14 4 2 Timeline 15 4 3 Software Development Environment 15 5 Architecture 15 6 Test Plan 17 6 1 Testing Script 17 6 2 Test Case Rationale 18 6 3 Testing Results 18 1 7 Lessons Learned 19 7 1 From Devesh 19 7 2 From Nishant 19 7 3 From Cheng 20 7 4 From John 20 A Appendix Test Cases 21 A 1 andTest 22 A 2 comments 22 A 3 const compare 23 A 4 dotoperator 23 A 5 facts 24 A 6 global directive 25 A 7 illegalchar 25 A 8 learnForget1 26 A 9 main 27 A 10 main fall through 28 A 11 mult main 28 A 12 negativeno 29 A 13 neq 29 A 14 not1 30 A 15 plist twice 30 A 16 printer test 31 A 17 prsimple 34 A 18 prstrings 34 A 19 range A 20 scoping 35 36 A 21 sim dot1 36 A 22 sim dot2 40 A 23 sim move 43 A 24 sim my loc 49 A 25 sim ndot2 52 A 26 sim two test 53 A 27 simulator test 58 A 28 sprint1 63 A 29 unsupported directive 64 A 30 variable comp 64 B Appendix Code Listings 65 B 1 parser mly 65 B 2 scanner mll 67 B 3 ast mli 68 2 B 4 printer ml 69 B 5 tst mli 71 B 6 trans ml 72 B 7 culog ml 77 B 8 simulator ml B 9 interp ml 78 84 1 Introduction C LOG C LOG is a logic language designed for entity interaction simulation It uses a brute force method for solution searching similar to Prolog but uses a syntax similar to C making it easier on the typical programmer s eyes and is compatible with some code tools such as code indenters and Emacs s c mode Simulations in C LOG involve a set of entities written in C LOG which interact in the simulator The environment entity defines the board on which the agents play and defines the game which the entities play It is a turn based simulation during which each agent can look at the contents of the environment and decide which which direction it should move During this decision the agents can modify their own working memory thus affecting their decision for the next turn Additionally the C LOG interpreter may be invoked separately from the simulator The stand alone interpreter searches for all the solutions for main but typically the output of these programs will be from print directives specified in the program 1 1 Application Features One uses the language to provide a set of facts and rules and the program is run by asking a question which the interpreter attempts to answer using inferences based on the fact and rule set C LOG is designed for simulation so typically a simulator will ask a given agent program what its next action will be The agent program then uses C LOG s entity interaction features to gather information about its environment and decide what to do Each agent program can communicate with other programs to find out more information about other agents or its own status in the environment The simulator stores all the contextual information pertaining to the environment and all of the agents present As this language is going to be used for simulating real life agents we strongly emphasize that the program learn and forget data rules information at run time For this similar to assert and retract of Prolog we have introduced two directives called learn and forget In C LOG there exist no specific data structures like you would see in Java or Python however rules and facts can be added to the program dynamically which allows programs to remember data in a much more natural way since the data simply becomes part of the running code The simulator discussed could be modified to be used in other with other simulation environments such as in a three dimensional grid simulation with several agents such as a flight simulation Alternatively the interpreter could be used in a real environment like the movement of pick and place robots in a warehouse The language could be used to define the warehouse environment and agent programs for robots and a replacement for the simulator would feed live information in to the programs in the form of facts similarly to how the simulation feeds its state information to agents now 3 1 2 Goals The language and simulator presented here attempts to fulfill the following requirements Generic Games are defined mostly by the environment application Composable Individual behaviors can be written simply and easily then combined to obtain high level actions and reasoning Declarative Programmers can specify what they want entities to do rather than how Controlled Communication Data in the system is frequently made up of nearly atomic bits of data many of which can be used both on their own and composed as complex data This means that subsets and smaller pieces of data can be communicated between entities without loosing meaning High level libraries Due to the flexibility and composibility of the language high level algorithms such as path finding can be easily implemented in libraries allowing further domain specific intelligence to be written in the programs 2 Tutorial Logic programming is a kind of computer programming using mathematical logic Specifically it is based on the the idea of applying a theorem prover to declarative sentences and deriving implications Compared with procedural languages logic programming solves the problem by setting rules with which solutions must fit We can represent logic programming by the formula F acts Rules Solutions Logic programming languages are inherently high level languages allowing programmers to specify problems in a declarative manner leaving some or all of the details of solving the problem to the interpreter Both the programming and data structures in both prolog and C LOG can be very simple such as facts The relationship between code and data is also of note C LOG uses the Von Neumann style vs Harvard architecture wherein data is code It is therefore possible and inherently necessary for programs to be introspective and self modifying In other words it is easier for programs to learn and adapt 2 1 Variables Variables represent


View Full Document

Columbia COMS W4115 - CµLOG Project Final Report

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 CµLOG Project Final Report 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 CµLOG Project Final Report 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?