CmpE 320 Spring 2008 Programming Project #2

Similar documents
Turkish Match Fixing Scandal in and Beyond

LITTLE BASKETBALL STREETBALL TOURNAMENT. Bulletin No: 13 (12 25 May 2014) Page 1 BASKETBALL

How To Read Data Files With Spss For Free On Windows (Spss)

PHR 487Q Syllabus Oral and Written Communication Skills for Scientists

Online Course Development Guide and Review Rubric

Probability, statistics and football Franka Miriam Bru ckler Paris, 2015.

COMPSCI 105 S2 C - Assignment 2 Due date: Friday, 23 rd October 7pm

Battleships Searching Algorithms

Testing Web Applications for SQL Injection Sam Shober

Technology WHITE PAPER

Curriculum Map. Discipline: Computer Science Course: C++

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

Project 2: Bejeweled

COURSE SYLLABUS INTRODUCTION TO INTERNATIONAL BUSINESS, MGT ONLINE FALL 2013

MGT Managing and Using Information Technology

Introduction to Computer Programming (CS 1323) Project 9

Course Syllabus. COSC 1437 Programming Fundamentals II. Revision Date: August 21, 2013

Pre-Match Betting Plus Rules & Policies

COM 2733 Introduction to Communication Technologies. Course Materials Handbook. (Summer 2005) Prepared by. H. Paul LeBlanc III.

Complement. If A is an event, then the complement of A, written A c, means all the possible outcomes that are not in A.

Programming Exercise 3: Multi-class Classification and Neural Networks

INDIVIDUAL MASTERY for: St#: Test: CH 9 Acceleration Test on 29/07/2015 Grade: B Score: % (35.00 of 41.00)

INDIVIDUAL MASTERY for: St#: Test: CH 9 Acceleration Test on 09/06/2015 Grade: A Score: % (38.00 of 41.00)

Project 2: Web Security Pitfalls

Access Tutorial 3 Maintaining and Querying a Database. Microsoft Office 2013 Enhanced

Tutorial 3 Maintaining and Querying a Database

Guidance for Industry

Call Recorder Quick CD Access System

12 Step Checklist for Meeting Quality Matters Standard 1

Easy Casino Profits. Congratulations!!

Syllabus. MANAGEMENT 4210: Advertising and Promotions Spring 2010 T/Th 12:15-13:30, Room D631

Artificial Intelligence

COURSE SYLLABUS EDG 6931: Designing Integrated Media Environments 2 Educational Technology Program University of Florida

Treasure Island Sports Book House Wagering Rules

Assessment of Learning Report Computer Science CPT/CPM Fall 2006 Spring I. Introduction and Background

Numerical Algorithms for Predicting Sports Results

Introduction to XML Applications

Computer Science 1015F ~ 2010 ~ Notes to Students

Web Applications Security: SQL Injection Attack

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

HOW TO PLAY JustBet. What is Fixed Odds Betting?

What are we dealing with? Creating a New MS Access Database

Recruiting-101 s Five Steps to a Scholarship Offer June, 2008

AMERICAN NATIONAL GOVERNMENT University of Central Oklahoma Department of Political Science

JEFFERSON COLLEGE COURSE SYLLABUS CIS-236 SQL AND DATABASE DESIGN. 3 Credit Hours. Prepared by: Chris DeGeare CIS Instructor. Revised: 3/11/2013

Commercial Database Software Development- A review.

DIABLO VALLEY COLLEGE CATALOG

Course Content Concepts

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

6.042/18.062J Mathematics for Computer Science. Expected Value I

Cybersecurity Championship Cup Collegiate Algorithm and Rules

CS Matters in Maryland CS Principles Course

Course Outline Semester 2, 2013

How To Set Up A Smartwork Course

Tivoli Endpoint Manager BigFix Dashboard

West Windsor-Plainsboro Regional School District Computer Programming Grade 8

C A R I B B E A N E X A M I N A T I O N S REPORT ON CANDIDATES S WORK IN THE CARIBBEAN SECONDARY EDUCATION CERTIFICATE EXAMINATION MAY/JUNE 2012

CMPT 354 Database Systems. Simon Fraser University Summer Instructor: Oliver Schulte

4. Are you satisfied with the outcome? Why or why not? Offer a solution and make a new graph (Figure 2).

10605 BigML Assignment 4(a): Naive Bayes using Hadoop Streaming

Features List Contents

COWLEY COLLEGE & Area Vocational Technical School

Using Power to Improve C Programming Education

ST. MARY S COLLEGE FORM 5

Social Media Usage In European Clubs Football Industry. Is Digital Reach Better Correlated With Sports Or Financial Performane?

CSCI 1301: Introduction to Computing and Programming Summer 2015 Project 1: Credit Card Pay Off

Course Syllabus Geography Program Winthrop University Spring GEOG/GEOL 305 Introduction to Geographic Information Systems

FOPR-I1O23 - Fundamentals of Programming

Tutorial 3. Maintaining and Querying a Database

Microsoft Office 2010

Scenario: Optimization of Conference Schedule.

Does NFL Spread Betting Obey the E cient Market Hypothesis?

Module 1. Internet Basics. Participant s Guide

Studio 5.0 User s Guide

Program Development Project Management (PDPM) Syllabus

Performance Tuning for the Teradata Database

USER GUIDE. Unit 5: Tools & Modules. Chapter 3: Forms & Surveys

Computer Programming I

Chapter 7: Software Development Stages Test your knowledge - answers

PM: Project management software

DATA ITEM DESCRIPTION

Exam #1 (100 points)

Geography 676 Web Spatial Database Development and Programming

Assignment 4 CPSC 217 L02 Purpose. Important Note. Data visualization

these three NoSQL databases because I wanted to see a the two different sides of the CAP

Employee means the person employed by the Company; Punter means the person who places a bet with the Company;

Web System Design and Management. Description. Learning Objectives GLIS 634. Page 1 of 7. Winter 2015

How To Write A Policy Brief

AWARD. rendered by COURT OF ARBITRATION FOR SPORT. sitting in the following composition:

Effective Practices for Fully Online and Blended Courses

Database Applications Microsoft Access

HTML Egg Pro. Tutorials

Course: CSC 222 Database Design and Management I (3 credits Compulsory)

PELLISSIPPI STATE COMMUNITY COLLEGE MASTER SYLLABUS MICROSOFT OUTLOOK CBT OST 1010

2014 Spring Session I (7.5 Week Courses) 1/2/2014 2/22/2014

Thursday 11:00 a.m. - 12:00 p.m. and by appointment

Computation and Economics - Spring 2012 Assignment #3: File Sharing

Memopol Documentation

Audio Video Production

Homework Assignment #1: Answer Key

Transcription:

CmpE 320 Spring 2008 Programming Project #2 Problem Description This project will test your knowledge of logic programming and Prolog. Your project will be graded on correctness, readability, testing strategy, efficiency, documentation, and the use of logic programming style. Your task is to write Prolog predicates (statements) for manipulating lists of football teams, and the matches played between them. You may use additional predicates as needed in defining these predicates. Copy the file superlig.pl posted on the class website into your working directory. The file contains a database of facts about 8 teams and the played matches that you may use to test and debug your program. The predicates that will be used are as follows: team(teamname, hometown). match(week, hometeam, hometeamscore, awayteam, awayteamscore). The following is a portion of a sample database illustrating the two relations that are defined: team(ankaragucu, ankara). team(besiktas, istanbul). team(fenerbahce, istanbul). team(galatasaray, istanbul). team(kayserispor, kayseri). team(oftas, ankara). team(sivasspor, sivas). team(trabzonspor, trabzon). match(1, ankaragucu, 2, kayserispor, 0). match(1, besiktas, 1, oftas, 0). match(1, sivasspor, 1, fenerbahce, 0). match(1, galatasaray, 4, trabzonspor, 0). match(2, besiktas, 2, ankaragucu, 0). match(2, fenerbahce, 2, galatasaray, 1). match(2, sivasspor, 0, oftas, 1). match(2, trabzonspor, 2, kayserispor, 1). The first predicate shows the teams currently existing in the database. For example team(fenerbahce, istanbul). means that fenerbahce is a team that plays home matches in istanbul. The second predicate implies that there has been a match between the two given teams in the given week. Score is also given in the predicate. To illustrate, match(2, trabzonspor, 2, kayserispor, 1). implies that In the 2 nd week, trabzonspor defeated kayserispor with the score of 2-1. You will implement the predicates described below, as well as any necessary additional predicates to support them, that use these facts to create collections of teams and matches with different constraints on them. You will need to load the database file or a similar database of your own creation into Prolog. When you are testing, you can simply copy and paste the facts in your working file but you must put the predicates that you implement into a separate file called superligpredicates.pl when submitting. te that you must put all your predicates in the same file. Do not create a different file for each predicate. Important tes You may not use any of the following in any predicate you write: ; ( or ) -> ( if-then )! (cut) insert Any other operator that is not a part of true logic programing.

Your Tasks 1. Super League Teams Implement the predicate allteams(l,n). L is the list containing all the teams in the database where N is the number of elements in the list. (Hint: Learn the differences between Prolog s built-in functions such as findall, setof, bagof which you can use in your predicates.) An important issue is that you will see ; (semicolon) in some of the example outputs below which means that I continue querying by pressing ; and the next result is retrieved by Prolog. If there is no other result left, then it returns. If I don t make a new query and press enter it returns. For this and each of the predicates described below, you should be able to specify queries with any combination of variables and constants unless it is specified otherwise. For example (for the sample database given to you):?- allteams(l,n). L = [ankaragucu, besiktas, fenerbahce, galatasaray, kayserispor, oftas, sivasspor, trabzonspor] N = 8 ; L = [ankaragucu, besiktas, fenerbahce, galatasaray, kayserispor, oftas, trabzonspor, sivasspor] N = 8 ; L = [ankaragucu, besiktas, fenerbahce, galatasaray, kayserispor, sivasspor, oftas, trabzonspor] N = 8?- allteams([trabzonspor,besiktas,ankaragucu,fenerbahce,galatasaray,kayserispor,oftas,sivasspor],8). 2. Home Teams Implement teams(l,c,n) where L is any list containing the teams of city C where N is the number of elements in the list. You can assume that C is always given as a constant.?- teams(l,ankara,n). L = [ankaragucu] N = 1 ; L = [ankaragucu, oftas] L = [oftas, ankaragucu] L = [oftas] N = 1 ;?- teams([galatasaray,besiktas],istanbul,2).?- teams([galatasaray,besiktas],istanbul,1).?- teams(l,izmir,n). 3. Match Results Implement the following predicates: wins(t,w,l,n) implies that L involves the teams defeated by team T when we are in week W and N is the number of elements in L.

losses(t,w,l,n) implies that L involves the teams those defeated team T when we are in week W and N is the number of elements in L. draws(t,w,l,n) is very similar but now L involves the teams that team T could not defeat nor did not lose to. te that when we say, we are in week W, that means there have been W matches played by a team. So you will consider all these matches played by the queried team. You can assume that T and W will be given as constants.?- wins(galatasaray,5,l,n). L = [trabzonspor, kayserispor, ankaragucu] N = 3 ;?- losses(galatasaray,5,l,n). L = [fenerbahce, besiktas]?- draws(galatasaray,5,l,n). L = [] N = 0 ; 4. Total Points of a Team Implement point(t,w,p) where P is the total points gathered by team T up to week W. A win counts for 3 points, a draw worth 1 point and a loss does not give any points. Assume T and W are given as constants.?- point(galatasaray,5,p). P = 9?- point(ankaragucu,4,p). P = 7 5. Total Average of a Team Implement average(t,w,a) where A is the average (goals scored goals in) of a team T gathered up to week W. Assume T and W are given as constants.?- average(fenerbahce,2,a). A = 0?- average(sivasspor,3,a). A = -1?- average(ankaragucu,3,a). A = 1 6. Best to Worst Implement sortteams(teams,w,sortedteams) where Teams (a list of teams) and W (week) are given as constants and SortedTeams will be the team list ordered from best to worst when we are in week W. Team A is better than team B if its point is greater than team B. If their points are equal, then the one with the higher average is better. If their averages are also the same, then the one which scored more goals is better. tice that we do not look at the match played between them. If the scored goals are also the same, then the order of these teams can be any order. Hint: Sorting will be a difficult problem for you, so you will implement a very simple sorting technique. First, permute the given teams and try as if it is sorted or not. The algorithm works on N! time complexity. This is the reason why there are 8 teams in the database. The sorting query is required to response in a few seconds.

?- sortteams([fenerbahce,galatasaray,ankaragucu,besiktas],2,sortedteams). SortedTeams = [besiktas, galatasaray, fenerbahce, ankaragucu] ; SortedTeams = [besiktas, galatasaray, ankaragucu, fenerbahce] ;?- sortteams([fenerbahce,galatasaray,ankaragucu,besiktas,kayserispor],5,sortedteams). SortedTeams = [besiktas, fenerbahce, galatasaray, ankaragucu, kayserispor] ; 7. League Order and Top 5 Implement leagueorder(l,w) where W (week) is given as constant and league order in that week will be retrieved in L. Additionally, implement topfive([t1,t2,t3,t4,t5],w) where T1 to T5 are the top teams when we are in the given week W.?- leagueorder(l,3). L = [besiktas, ankaragucu, fenerbahce, trabzonspor, galatasaray, oftas, sivasspor, kayserispor] ; L = [besiktas, ankaragucu, fenerbahce, trabzonspor, galatasaray, sivasspor, oftas, kayserispor] ; L = [besiktas, fenerbahce, ankaragucu, trabzonspor, galatasaray, oftas, sivasspor, kayserispor] ; L = [besiktas, fenerbahce, ankaragucu, trabzonspor, galatasaray, sivasspor, oftas, kayserispor] ;?- leagueorder(l,5). L = [besiktas, fenerbahce, galatasaray, trabzonspor, ankaragucu, sivasspor, oftas, kayserispor] ;?- topfive([t1,t2,t3,t4,t5], 5). T2 = fenerbahce T3 = galatasaray T5 = ankaragucu ;?- topfive([t1,t2,t3,t4,t5], 4). T2 = ankaragucu T3 = fenerbahce T5 = galatasaray ; T2 = fenerbahce T3 = ankaragucu T5 = galatasaray ;

Submission You will submit (both electronically and in printed form) The superligpredicates.pl source code which involves the predicates you have written. This file will not include the database. A report (program document) of your work. One test case (other than the given database) as a separate file. Prepare an additional report with this sample database you prepared, the inputs you used for testing, and the outputs must be included. Do not randomize the scores in your database, think about creating a fresh one, e.g. basketball league. More about the Project In addition to learning Prolog in this project, you are also dealing with an interesting problem. Since this is a very introductory project, the database and the predicates are very limited. Imagine that you are asked to complete a similar but very advanced project (for example Championship Manager); you will need players, player profiles, team profiles, places and more in your application. We did not guess any match in this project, but it can also be extended to guess the results of real life matches from the previous data which is a difficult problem in machine learning. You can get a real database and try to guess the next week s matches with your own assumptions in your spare time. tes Prolog program (SWI Prolog) with some manuals and tutorials are on the Download Files part of the course website. The default font may not be convenient for code writing, so you can set it to Courier for the sake of your eyes. Try to use hints given in every predicate. The project will be done individually, not as a group. We will test your program with our database. The strict deadline is 02.06.2008 at 00:00 for electronic submission and 03.06.2008 at 17:00 for hard copy submission. The deadline will not be postponed. Important!!!: Read the Programming Projects section in the document General Information for Students link in the Syllabus. You should obey the rules for electronic submission (e-mail subject, etc.) and documentation.