Fantasy Cricket Game GUI using Python :-

Tushar Jain
4 min readSep 19, 2021

Fantasy Cricket Game GUI using Python(PyQt5) and sqlite3 is an online game where we can create a virtual cricket Team of Real Cricket Players.

Programming Language Used: Python

Fantasy Cricket Game

Fantasy Cricket Game is a game where we can create a virtual cricket team of real cricket players. Each player has their own Points. There will be a limited no. of points to select 11 players, if we don’t have enough points we can’t select a player if his points are more and the team is evaluated using points of each player based on their performance internally. To win a tournament, we must try and get the maximum points and the №1 rank amongst other participants.

Rules:-

Batting: 1 point for 2 runs scored, Additional 5 Points for half Century, Additional 10 points for a century, 2 points for strike rate (runs/balls faced) of 80–100, Additional 4 points for strike rate>100, 1 point for hitting a boundary (four) and 2 points for over boundary(six).

Bowling: 10 points for each wicket, Additional 5 points for 3 wickets/innings, additional 10 points for 5 or more wickets in innings, 4 points for econiomy rate (runs given per over) between 3.5 and 4.5, 7 points for economy rate between 2 nd 3.5, 10 points for economy rate less than 2.

Fielding: 10 points each for catch/stumping/run out.

You can check the DataBase created for this Game named Fantasycricket.db.

To execute this program, we need to install PyQt5 which is a Python GUI Library.
And that’s, we are all set to run this program.

If we want to make changes in the “evaluate teams” which is present in the evaluation module, we can change manually by just editing the code, but the edited code will not reflect back to the main GUI. To execute the edited “evaluate teams” code, we need to install the evaluation module.

Instruction to install :-

1. Inside the evaluation folder, we will see the evaluation folder.

2. Open cmd to that location, and type “pip install evaluation”.

3. That’s it. Edited “evaluate teams” code will be reflected back to the main GUI.

Collecting Evaluation and downloading files:-

In this project, we can create a team based on our Points, We can save the team, We can view our team, we can modify our team, we can delete our existing team and we can evaluate the team.

Main files:-

Main files
Options to fill the essential details about player and to get result

Step 1:- Create Team ie-players details

Step 2 :- Evaluate Team ie- players are valid or not

Step 3:-Open Team

Step 4 :- See Scores

Column to insert Players name
Here we get the Results
Result Dashboard

Code for entering player details :-

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_New_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(“MainWindow”)
MainWindow.resize(400, 400)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName(“centralwidget”)
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(110, 80, 170, 20))
font = QtGui.QFont()
font.setPointSize(15)
self.label.setFont(font)
self.label.setObjectName(“label”)
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(100, 130, 191, 31))
self.lineEdit.setObjectName(“lineEdit”)
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(130, 190, 121, 41))
self.pushButton.setObjectName(“pushButton”)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 400, 21))
self.menubar.setObjectName(“menubar”)
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName(“statusbar”)
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.pushButton.clicked.connect(MainWindow.close)

def create(self):
team_name = self.lineEdit.text()
return team_name

def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate(“MainWindow”, “MainWindow”))
self.label.setText(_translate(“MainWindow”, “Enter TEAM Name”))
self.pushButton.setText(_translate(“MainWindow”, “OK”))

if __name__ == “__main__”:
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_New_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

project submittted by :- Aditi jain

ENO:- TCA1909031

--

--