Assignment 04 (Due: Thursday, August 115, 2016, 11 : 59 : 00PM (Central Time)))
CSCE 322
Contents
- 1 Instructions 1 1.1 DataFileSpecification 1 1.2 columnsAndPlayers(Game) 2 1.3 fewestDrops(Game,Drops) 2 1.4 notStackedTeammates(Game).. 3 1.5 notDiagonalTeammates(Game). 3
- 2 Compilation & Execution 4
- 3 Webgrader Warning 4
- 4 Naming Conventions 4
- 5 Point Allocation 4
- 6 External Resources 4
List of Figures 1 Instructions
This assignment will use Prolog to extract certain information about the state of a variation of Connect Four.
1.1 Data File Specification
The game will be represented as a list of lists of symbols.
1
[5,3,3,4,3,2,7,5,4,7]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,-,-,-,-,-,-,x]. [x,-,2,-,-,-,-,2,x]. [x,-,2,1,-,-,1,1,x]. [x,x,x,x,x,x,x,x,x].
1.2 columnsAndPlayers(Game)
The query columnsAndPlayers(Game) will be successful when the game state has an odd number of columns and an odd number of players in the game, or an even number of columns and an even number of players in the game.
game [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,x] [x,-,2,-,-,-,-,2,x] [x,-,2,1,-,-,1,1,x] [x,x,x,x,x,x,x,x,x] false
1.3 fewestDrops(Game,Drops)
The query fewestDrops(Game,Drops) will be successful when Drops is unified with the shortest valid path (fewest number of drops) from the current state of the game to a won game for Player 1. There may be multiple shortest paths, and fewestDrops(Game,Drops) should report them all, if ; appears in the query.
Page 2
game [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,1,-,-,-,-,-,x] [x,2,-,-,-,-,-,x] [x,2,-,1,-,-,1,x] [x,x,x,x,x,x,x,x] paths
[4,5]
[5,4]
true
1.4 notStackedTeammates(Game)
The query notStackedTeammates(Game) will be successful when teammates are not stacked in the game.
game [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,x] [x,2,1,-,-,-,-,x] [x,2,2,1,-,1,1,x] [x,x,x,x,x,x,x,x] false
1.5 notDiagonalTeammates(Game)
The query notDiagonalTeammates(Game) will be successful when teammates are not diagonal from each other.
Page 3
game [x,-,-,-,-,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,-,-,-,-,x] [x,-,-,-,-,-,-,-,-,1,-,-,x] [x,-,-,-,-,-,-,-,-,3,-,-,x] [x,-,3,-,-,-,-,-,-,1,-,-,x] [x,1,2,3,2,3,2,-,-,1,-,2,x] [x,x,x,x,x,x,x,x,x,x,x,x,x] false
2 Compilation & Execution
Your program will be tested on cse.unl.edu, using pl. hmwrk04tests.pl will include test cases for testing your program. You can run the test cases with the commands:
[hmwrk04tests].loadHelpers.part01.
3 Webgrader Warning
Prolog programs can take some time to run. The webgrader is limiting individual processes to 5 minutes.
4 Naming Conventions
You will be submitting at least 4 .pl files. The filenames should be csce322hmwrk04part01.pl, csce322hmwrk04part0 csce322hmwrk04part03.pl, and csce322hmwrk04part04.pl
5 Point Allocation
Component |
Points |
csce322hmwrk04part01.plcsce322hmwrk04part02.plcsce322hmwrk04part03.plcsce322hmwrk04part04.pl |
20 30 20 30 |
Total |
100 |
6 External Resources
Prolog Wikibooks
Learn Prolog Now!
Prolog Tutorial Category:Prolog Rosetta Code
Page 4
Reviews
There are no reviews yet.