Indian Premier League (IPL) Simulation
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Artificial Intelligence and Mechatronics Volume 1, Issue 6, ISSN 2320 – 5121 Indian Premier League (IPL) Simulation Ajinkya Kulkarni Karthik Rao Gaurav Joshi Department of Computer Engineering, Department of Computer Engineering, Department of Computer Engineering, Sinhgad College of Engineering, Sinhgad College of Engineering, Sinhgad College of Engineering, University of Pune, India University of Pune, India University of Pune, India Email: [email protected] Email: [email protected] Email: [email protected] Nikhil Jain Saurabh Kharote Department of Computer Engineering, Department of Computer Engineering, Sinhgad College of Engineering, Sinhgad College of Engineering, University of Pune, India University of Pune, India Email: [email protected] Email: [email protected] Abstract – The Indian Premier League is a franchise based The user has two options while playing a match in the T20 cricket tournament. The proposed project uses various league. He can either simulate the complete match or he AI techniques and simulation algorithms to provide the can simulate the bowling and play the batting. complete IPL experience. For simulating the first innings we use a custom The IPL starts with an auction where a franchise buys implementation of the Bayesian latent variable model. players according to their needs and their budget. Then they use these players in the tournament to win matches. The For the second innings, we use the combination of tournament has a league based Double Round robin format Bayesian latent variable model and use the Duckworth- and the winner of this format qualifies for the playoffs. Lewis method as we have runs which can be used as The project uses a custom implementation of resource feedback. allocation algorithm and the Bayesian latent variable model We have developed a small game in Unity to allow the for the auction simulation. user to actually play the batting innings of his match. The game uses parameters like the batsman ratting, form, runs Keywords – Premier League, AI Techniques, Robin scored and bowler faced to make the game performance Format, Allocation Algorithm. realistic. A. Problem Definition I. INTRODUCTION Given: 1. user input while bidding for a player during the auction. Cricket is a religion in a country like India. The Indian 2. Team selection before a match. Premier League is one of the most happening t20 3. Bowler selection during simulation of bowling. cricketing tournaments all over the world. Every cricket 4. Game inputs while playing the game. fan can relate to some or the other city team in the IPL and B. Objective wishes he or she could be a part of his team (like The main objective of the system is to provide the participate in buying players during auction, selecting the appropriate output for a user given input dynamically in match 11, resting players, etc.). The proposed project form of a simulation and also providing him multiple engrosses the user to play the sport they follow virtually as options to manage his resources. an owner cum manager and make all the strategic Algorithm for batting game play: decision. It also has a game play that allows the user to 1. Game scenario created. actually play the batting innings of the match. 2. Game objects imported. So, banking on this, we are trying to create a simulation 3. System parameters initiated. which covers all these points and provide the user with 4. Animated event initialized by system. ultimate experience. Our simulation consists of a player 5. A loop is set for the number of balls to be balled during who selects his preferred team and manages it. the match. Our simulation is divided into two parts: a. A ball is bowled by the system. The location is 1: Auction- A player buys a team. random and the speed is determined by the bowler 2: Playing the league- Manage the team and lead it to rating and bowler form. The more the value the success. higher the probability of a fast ball. 1) Auction- our auction process is based on resource b. User keyboard input required to play the shot. allocation in decision making systems. We use the auction i. If the input is valid, and the bat hits the ball. simulation logic to create the team. Many factors would be calculate the estimated runs using the velocity of considered such as requirements of the team, budget of the the ball as a limiting value. team, no of players bought, etc. These factors will play a ii. If the input is invalid, no action is taken. role in the creation of final team. For example, Mumbai 6. The final score is calculated. Indians is a big spending team which requires quality and 7. Result is generated and values are updated for all the experienced players. Whereas Rajasthan Royals do not players. spend big. 2) Playing a match in the league- Copyright © 2013 IJAIM right reserved 137 International Journal of Artificial Intelligence and Mechatronics Volume 1, Issue 6, ISSN 2320 – 5121 Explanation: ChangeBowler: Changes bowler and switches batsman. This is the algorithm for actual batting using keyboard Dry Run controls and animated objects. CPU player will start the Case I: event by initiating ‘Bowling event’. User will accept that Ball = 10 event and react using keyboard controls. The direction of Batsman = Sachin Tendulkar (Form = 3, Ratting = 8) the ball will depend upon Bowler = Morne Morkel (Form = 9, Ratting = 8) - Original direction Pitch Bowling -10 - Batsman timing (It will be affected by batsman New Batsman +10 parameters. i.e. more delay for less rated player.) On the 11th ball - Ball speed (Depending on type of bowler) CalculateUi() - Shot selection (using keyboard directions) { - Pitch of the ball (It will be generated by a random Ui = 3 + 8 - 10 function modulated by Bowler rating. i.e. high rated } bowlers will bowl accurately.) CalculateUj() The result of the shot will be decided by { - Shot selected (elevation or ground stroke) Uj = 9 + 8 + 10 - Field settings } - Batsman timing and rating. Therefore, Algorithm for innings simulation B = Uj – Uj + e 1. Store limiting values in array (A[6] = {-30,-20,- = 1 – 27 + e 10,10,20,30}) e is a random generated value can range from [-30 to + 30] 2. For every ball in the innings (ball=1..120) assume it to be 0. a. If (Wicket == 10) break B = -26 b. If(ball%6 == 0) Thus the output of this will be 0 runs i. ChangeBowler(); Case II: c. Ui = CalculateUi(Wicket) Ball = 110 d. Uj = CalculateUj(ball) Batsman = Ashish Nehra (Form = 1, Ratting = 4) e. Generate Random Value using formula Bowler = Morne Morkel (Form = 9, Ratting = 8) (B = Ui – Uj + e). Pitch Bowling -10 f. If(B > A[5]) New Batsman +10 th i. Run = 6 On the 111 ball g. If(B>A[4] && B<A[5]) CalculateUi() i. Run = 4 { h. If(B>A[3] && B<A[4]) Ui = 1 + 4 -10 i. Run = 3 } i. If(B>A[2] && B<A[3]) CalculateUj() i. Run = 2 { j. If(B>A[1] && B<A[2]) Uj = 9 + 8 + 10 i. Run = 1 } k. If(B>A[0] && B<A[1]) Therefore, i. Run = 0 B = Ui – Uj + e l. If(B) = – 5 – 27 + e i. Wicket++; e is random generated value can range from [-30 to +30] m. Sum = Run + Sum assume it to be 0. n. Update Bowler and Batsman stats. B = – 32 Description: Thus the output will be ashish nehra gets out utility Limiting values (A[0..5]): Limiting values is used to function composed of business matrix and are tweak the boundary on the number of runs scored in customizable for different organizations and priorities. various scenarios. Y. Naveh et. al. provides a solution which takes the CalculateUi: Function Calculates and returns the batting preferences of employees. These preferences are variable. It is calculated using the Sum of: considered as soft constraints with lower priority. This - Batsman form empowers the DSS to generate two types of allocations; Project and Employee Biased. - Batsman Rating Ahilton Barreto et. al. suggests an optimization based - Pitch condition approach for assignment problems. More than one utility CalculateUj: Function Calculates and returns the functions based on multiple parameters such as time, cost bowling variable. It is calculated using the Sum of: etc., are developed to assist the decision maker. The - Bowling form system provides some or all possible solutions for the - Bowling Rating given CSP, and also provides optimal solutions based on - Batsman Settled selected utility function. Copyright © 2013 IJAIM right reserved 138 International Journal of Artificial Intelligence and Mechatronics Volume 1, Issue 6, ISSN 2320 – 5121 II. PROPOSED SOLUTION AND MATHEMATICAL T: = SET of teams. MODEL U: = SET of users. 3. Description for M2 Mathematical Model The second module gives the overview of the actual SIMULATION and the gameplay. Proposed solution Based on the equation of Bayesian Latent Variable Model 1. Let ‘S’ be the system that describes “IPL Simulation and the assistance of D/L methodology to generate the 2013” result for a particular match Module 2 gives the exact S= {P, T, U, M1, M2}. demonstration for the same. Where, Let M2 be the system that describes “Simulation” P: = SET of players. M2 = {T, U ,M , ip2 , op2 , simulate , s12, f2} T: = SET of teams. Where, U: = SET of users. T: = SET of teams. M1: = Module 1. U: = SET of users. M2: = Module 2. M: =SET of matches. 2. Description for M1 a. Identifying INPUT states: IPL AUCTION is based on the very concept of ip2= Strategic Resource Allocation which gives us the tools {match_details,Team_details,User_details,player_details} to allocate the resources based on the requirements as Where, and when needed.