程序代写代做代考 prolog Assignment 04 (Due: Wednesday, April 26, 2017, 11 : 59 : 00PM (Central

Assignment 04 (Due: Wednesday, April 26, 2017, 11 : 59 : 00PM (Central

Time)))

CSCE 322

Contents

1 Instructions 1
1.1 Data File Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 columnsAndPlayers(Game) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 majoritySpaces(Game) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 winGame(Game,Clusters) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 gameWon(Game) (15% Extra Credit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Compilation & Execution 3

3 Webgrader Warning 3

4 Naming Conventions 3

5 Point Allocation 3

6 External Resources 3

List of Figures

1 Instructions

This assignment will use Prolog to extract certain information about the state of a variation of Battleflood.

1.1 Data File Specification

The game will be represented as a list of lists of symbols.

[7,6,5,4,2,1].

[2,4,1].

[2,1,4].

[1,1,3].

[1,2,2].

1

https://play.google.com/store/apps/details?id=com.the_10th_wave.battleflood_free

1.2 columnsAndPlayers(Game)

The query columnsAndPlayers(Game) will be successful when the number of columns in the game and
number of players in the game is even or the number of columns in the game and players in the game is
odd.

game

[2,4,1]

[2,1,4]

[1,1,3]

[1,2,2]

false

1.3 majoritySpaces(Game)

The query majoritySpaces(Game) will be successful when Player 1 occupies the majority of spaces in the
game.

game

[4,2,2,1]

[4,1,4,1]

false

1.4 winGame(Game,Clusters)

The query winGame(Game,Clusters) will be successful when Clusters is unified with the clusters (in
order) that would win the current state of the game for Player 1.

game

[1,2,2]

[2,1,1]

[1,2,2]

[2,2,2]

[1,2,2]

sequences

[2,2,2]

[2,4,2]

[3,2,2]

[3,3,2]

[6,2,2]

[6,3,2]

true

1.5 gameWon(Game) (15% Extra Credit)

The query gameWon(Game) will be successful when Game has already been won by any player (the occupy
all spaces in the game).

Page 2

game

[1,1,1,1,1]

[1,1,1,1,1]

[1,1,1,1,1]

[1,1,1,1,1]

true

2 Compilation & Execution

Your program will be tested on cse.unl.edu, using pl. h0mework04tests.pl will include test cases for
testing your program. You can run the test cases with the commands:

[h0mework04tests].

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 csce322h0mework04part01.pl,
csce322h0mework04part02.pl, csce322h0mework04part03.pl, and, maybe csce322h0mework04part04.pl.
If you do not submit a version of helpers.pl, the default file will be provided for your program.

5 Point Allocation

Component Points

csce322h0mework04part01.pl 30
csce322h0mework04part02.pl 30
csce322h0mework04part03.pl 40

Total 100

6 External Resources

Prolog – Wikibooks
Learn Prolog Now!
Prolog Tutorial Category:Prolog – Rosetta Code

Page 3

http://en.wikibooks.org/wiki/Prolog
http://www.learnprolognow.org/
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/contents.html
http://rosettacode.org/wiki/Category:Prolog

Instructions
Data File Specification
columnsAndPlayers(Game)
majoritySpaces(Game)
winGame(Game,Clusters)
gameWon(Game) (15% Extra Credit)

Compilation & Execution
Webgrader Warning
Naming Conventions
Point Allocation
External Resources

Leave a Reply

Your email address will not be published. Required fields are marked *