8
AI CHALLENGE Introduction: Connect Four (also known as Captain's Mistress, Four Up, Plot Four, Find Four, Fourplay, Four in a Row and Four in a Line) is a two-player game in which the players first choose a colour and then take turns dropping their colour discs from the top into a seven-column, six- row vertically-suspended grid. The pieces fall straight down, occupying the next available space within the column. The object of the game is to connect four of one's own discs of the same colour next to each other vertically, horizontally, or diagonally before one's opponent can do so. Does this sound pretty simple..!!?? So here comes the twist. No more boring gameplay with only the normal colour disks falling to their places. If u fell that you made a bad move or your opponent played a tricky move then you will get a chance to ruin his strategy by using your powers. In this game of power connect 4 you will get 4 types of special powers, one of each of them per set. So what do you say, now can u overpower your opponent. Can you line up four discs in a row before your opponent does? Problem Statement: The teams have to submit codes for an artificial intelligence which can play a complete game of power connect 4. At a time, two codes will play the game of power connect 4. Framework: The competition aims to provide an interface for codes of different teams to simultaneously play the modified version of the famous game ‘CONNECT FOUR’ which is also know by the name ‘FOUR IN A ROW’ against each other. The codes can be in the following languages: 1. C 2. C++ 3. Java 4. Python Note: In the entire documentation, ‘user’ refers to the team and ‘admin’ refers to the administrator. A part of the code will be submitted by the user and the rest will be created

Ai challenge

Embed Size (px)

DESCRIPTION

Completer pdf file for AI challenge.....

Citation preview

Page 1: Ai challenge

AI CHALLENGE

Introduction:

Connect Four (also known as Captain's Mistress, Four Up, Plot Four, Find Four, Fourplay,

Four in a Row and Four in a Line) is a two-player game in which the players first choose a

colour and then take turns dropping their colour discs from the top into a seven-column, six-

row vertically-suspended grid. The pieces fall straight down, occupying the next available

space within the column. The object of the game is to connect four of one's own discs of the

same colour next to each other vertically, horizontally, or diagonally before one's opponent

can do so.

Does this sound pretty simple..!!?? So here comes the twist. No more boring gameplay with

only the normal colour disks falling to their places. If u fell that you made a bad move or

your opponent played a tricky move then you will get a chance to ruin his strategy by using

your powers. In this game of power connect 4 you will get 4 types of special powers, one of

each of them per set.

So what do you say, now can u overpower your opponent. Can you line up four discs in a

row before your opponent does?

Problem Statement:

The teams have to submit codes for an artificial intelligence which can play a complete

game of power connect 4. At a time, two codes will play the game of power connect 4.

Framework: The competition aims to provide an interface for codes of different teams to simultaneously play the modified version of the famous game ‘CONNECT FOUR’ which is also know by the name ‘FOUR IN A ROW’ against each other. The codes can be in the following languages:

1. C 2. C++ 3. Java 4. Python

Note: In the entire documentation, ‘user’ refers to the team and ‘admin’ refers to the administrator. A part of the code will be submitted by the user and the rest will be created

Page 2: Ai challenge

by the admin to help simulate and execute the entire game. The position of the disks present in frame will be given as integers (completely explained in the format of board.txt file later in this document).

Game Explanation: The game is a modified version of connect 4.The only difference is the extra 4 types of special disk.

1. Clear row 2. Clear column 3. Clear first neighbours 4. Dual colour

1.) Clear row: A self-destructing disk which will first go to the lower-most unoccupied

place available in the selected column and will destroy each and every disk in that row including itself.

2.) Clear column: A self-destructing disk which will first go to the lower-most unoccupied place available in the selected column and will destroy each and every disk in that column including itself.

3.) Clear first neighbours: A self-destructing disk which will first go to the lower-most unoccupied place available in the selected column and will destroy each and every first neighbour disk in that row including itself. e.g. if the Clear first neighbours disk is used with the 4th column selected and suppose 11 (see fig. below) is the lowest unoccupied position then it will destroy the disks at 17,10,3,4,5,12 and 19 if they are present and after that the disk will destroy itself.

4.) Dual colour: This is the NEUTRAL disk. It will support both the colours.

NOTE: Both teams will have all the 4 powers total but can use only once in a set anytime during the set but the DUAL COLOUR DISK must be used in the first ten turns of the team else the move will be consider illegal. Except the dual colour power, using the rest of the three powers is not a compulsion.

User Task:

The user has to make a program named <Teamid>.<file_extension>. Suppose the Team Id of a particular team is Co0023, then the program name should be Co0023.cpp or Co0023.java as the case may be. This program made by user will represent his decision at a particular stage of the game. The codes will have to produce the output.txt file when they are called. The first integer stands for the type of disk they want to use and the other integer stand for indicating the column in which the team wish to place their disc.

Page 3: Ai challenge

The numbers are in the same order as the spaces in the board.txt file i.e. 1 for the leftmost column and 7 for the rightmost column.

Text Files: To guide the user the entire course of game being played, he will be provided with some text files. Below is the description of them: team_no.txt: This text file will show the team number (1 or 2). The code has to read its team no. from this file for playing. board.txt: This text file will show the positions of the discs already placed in the frame and the places which are still blank. This file will be having 42 integers separate d by blank spaces. 0 – Indicates that the place is unoccupied. 1 – Indicates that team number 1 got its disc there. 2 – Indicates that the team number 2 got its disc there. 12 – Indicates that the dual colour block is present there.

The 42 integers in the file will be for their position on board as shown in fig.

Page 4: Ai challenge

output.txt: This is the file which the user’s code has to produce to tell their decision to the

admin about their next move.

The team’s code output will be 2 integers in this text file. First integer to choose the type of

disk they want to use and the second integer to choose the column in which they want to

place their disk.

The range of the First integer is from 1-5

1-Clear row disk

2-Clear column disk

3-Clear first neighbours disk

4-Dual colour disk

5-Normal disk

The range of Second integer is 1-7

1 For the leftmost column and 7 for the rightmost column

Apart from these a team can create its own help file for analysing opponent’s gameplay or

deciding their gameplay but not more than 5 files at a time.

Editable permissions to files: All the files are not both readable and writable. The permissions goes as follows:

1. team_no.txt: only readable 2. board.txt: only readable. 3. output.txt: readable and writable. The team has to write or return its decision in this

file only. The above files will be made by the administrator and will be in the same folder as the main

program of the team. So, the teams can directly use the names of these files in their codes.

The help files will be made by the teams only for their own convenience itself. These files

can either be in the current folder or can be inside a new sub-directory created by the team

in the current folder. Teams should create their help files (if needed) with names starting

with their team id. For example Co0012.txt so that it can be seen which file is created by

which team code and also this is to avoid common help file names of 2 codes resulting in

both editing the same file.

Page 5: Ai challenge

Game simulation:

1. The admin program will call team programs and provide them the required

information in the text files. The teams have to access the input files and their help

files and based on the data in those files, they have to decide their next move which

will be given back to the admin in the text file output.txt. The admin will update the

admin text files (i.e. board.txt etc) using this data and so the game goes on.

Whenever the code of a particular team is called, the only information team has, is

the input and his helper files.

2.Game will be held in 3 rounds:

ROUND 1 – Teams will be divided in random groups of two i.e. their opponent will be

chosen on the spot (randomly, no preferences). Teams will play game with their opponent

and the winner will be qualified to the round 2.

In a game of round 1 there will be 3 sets. The winner gets 2 points per set and if there is a

draw both teams get 1 point each. If after 3 sets both team got equal points then game will

be continued to best of 5. If we don’t get a winner in 5 sets then opponent will be changed.

Round 2 – Participants will be divided in 2 groups and games will be played with teams

within same group. Each team will get a chance to play with every team present in same

group. Beating an opponent will award you 2 pts. Game will be played in same manner as in

round 1 but this time if we don’t get a winner after 5th set then both teams will get 1 point.

On the basis of total number of points a team get, 6 teams (3 teams from each group) will

be selected for round 3(finals).

Every participant reaching ROUND 2 will be awarded with Certificate of Participation.

Round 3 (Final) – Each team will get to play with every other team and collects 2 points per

win and 1 point per draw. Top 3 scorers will be selected as 1st, 2nd and 3rd.

In case there is a tie between any two teams at any place selecting top 6 or top 3 then the

tie breaker rules will be applied.

1) Golden set rule – The two teams will play sets until one of them wins a set i.e. they

play a set ,if one of them win then we get a winner else another set will be played.

This will be continued till 10 games at max. If still we don’t get a winner then the bad

beat rule will be applied.

2) Bad beat rule – Randomly any other entry will be chosen to play with these two

teams and sets will be played. One who wins more sets against that common

opponent wins.

Page 6: Ai challenge

Every team reaching the Round 3 will be awarded with Certificate Of Excellence.

The top 3 teams will be given the Prizes along with the Certificate Of Excellence.

The game will be displayed on a graphical connect 4 interface.

In the first set of any game first turn will be decided randomly and after that teams will get

first turn alternatively.

At any stage if any code outputs any illegal output (column which is full , column except 1 to

7 ,try to use a power twice or don’t use the dual colour disk within first 10 turns) or fails to

respond in limit execution time(2 sec) then it will be called for 2 more times, if still it fails to

give an appropriate output then it will be considered as a quit. The opponent will be

considered as winner of that set.

INSTRUCTIONS: Rules, Tips and Instructions

1. The competition is open to all (NSITians as well as outsiders) but participants must be students of any college .No professionals or school students are allowed.

The codes should be in following languages only: 1. C

2. C++

3. Java

4. Python

2. The decision of the organizing team shall be regarded as final in case of any discrepancy.

3. A single file has to be submitted containing the source code. Text files will be created only during the game play.

4. Text files are an aid to the teams as the teams can guess the tactics of their opponents by judging their moves.

5. The maximum number of text files a team can make is 5. 6. Time the code of a particular team should take should be realistic, mostly less than 2

second. 7. Clever programming will surely have an upper edge over others. 8. Note that at any point of time the latest information will be that which is on the site.

The information provided in the pdf downloaded earlier may not be the latest. However, registered participants will be informed through mail about any changes on the site.

9. Any team found interfering with admin text files or opponent help files will be directly disqualified.

Page 7: Ai challenge

10. At least one member of the team should be present at the event day. Participants who won’t be able to come to N.S.I.T. on the event day should send an email with a serious cause and no one is responsible if their code works improperly on the event day. They will be directly disqualified.

11. After every round the teams qualifying for the next round will be given time to make changes in their program if they want to make some. No team will be allowed to change or edit their program once they submitted their program for the next round (except the first round).

12. In round 1 only if any team’s code failed to work (execution time exceeded or illegal output) then they will be given a chance to edit their program and their game will be played at the ending of the round.

13. Teams have to submit single source file with name as its team id. No exe file will be accepted.

Certificate Policy: Top 6 teams will be given the certificate of excellence. Top 3 teams will be give prizes along with the certificate of excellence. Teams clearing the first round will be given the participation certificate.

Team Specifications: The participating entries must be in a team of a maximum of 3 [three] people of same college. If the participating team feels that they require more participants, they can forward their request, with suitable reasons.

TIMELINE: The teams (maximum of three members) have to start preparing the code and they will have to submit the final code in proper format on 16th February, 2012. At least one member from each team should be present at the time of simulation of the team's code during the festival i.e. 18th to 19th February, 2012. Teams will have to submit their final code till 16th February. The codes will be compiled and tested after linking them with the admin program so to ensure that they works perfectly with the admin code . Teams will be reported with the problems faced if any.

The event will be in 3 rounds. Round 1 will be played on day 1 (18 th ) and the other two

rounds will be played on day 2(19th).

Page 8: Ai challenge

RESOURCES:

For a basic idea about the normal connect 4 game.

http://en.wikipedia.org/wiki/Connect_Four

If u want to give the basic connect 4 a try

http://www.mathsisfun.com/games/connect4.html

http://www.bigmoneyarcade.com/?action=playgame&gameid=46

http://www.roughoat.com/games/flash/connect4.html

NOTE : The event game is different from the basic connect 4 game there will be extra

powers in the event game ….

CONTACT US:

For further queries contact us

Contact No. Maid Id

Ankit Gupta +91-9990682023 [email protected]

Vishal Singh +91-9891664844 [email protected]