Business efficiency starting from scratch with Python

Creating a bowling lane payout table is a hassle. Alright, let's let __PC do it __.

An inexperienced person who is not familiar with information systems tried to implement a tool for the first time. I hope this will be helpful as an example of improving work efficiency that even beginners can do.

Introduction

Competitive bowling tournaments require a table to distribute players to the lane. This payout table states that "one player will not be paid to the same box more than once" and "any two players will not be paid more than once to the same box at the same time (in short," Is it the same box as you? " ”Does not occur)” is required. I don't think anyone outside the bowling area knows it well, so you can skip it. Anyway, it's quite difficult to create this manually + check it with your eyes (it takes more than an hour for humans to do it), so let's automate it with a tool. I put the finished product at the end of the page, so if you like (is there demand?).

0. Rough flow until the dividend table is completed

① Allocate lanes to players with random numbers ② Find a part that does not meet the conditions ③ Shuffle only the problem area ④ Repeat ②③ until the problem area becomes 0. ⑤ Output necessary information

1. Let's do it in Excel!

For the time being, I created a lane payout table manually using random numbers in Excel, and automated only the detection of problem areas. Since I started from a situation where I don't even understand Excel functions, I implemented a check mechanism while googled variously. I'm grateful that there is a lot of Excel-related information on the net. problem -Since the number of players and the number of boxes used are different for each tournament, it is necessary to manually assemble the check mechanism each time (it is troublesome). ・ The compatibility with Excel and enumeration is extremely bad.

2. Python

It's a hassle, so I wanted to go further with automation. Alright, let's do it with programming. But you can't use any programming language. So you will learn Python3 [^ 1]. Python is visually insanely easy to understand, so I recommend it as your first language. I also considered Excel VBA (so-called "macro"), but stopped because it seems to be awkward and less versatile. The implementation was just done, but it was quite difficult (in AtCoder, it feels like connecting the implementations of about Diff800). In the end, it was about 400 lines. I also realized how difficult it is to crush the corner case. problem -Since it is input / output as a character string on Python, it is necessary to copy and paste it with an Excel file, which is a little difficult to use.

3. openpyxl edition

From here, we aimed to improve the input / output method. This time, I used the openpyxl module that can handle Excel files on Python. A module is like a toolbox, and importing it extends what you can do on Python. Python is especially rich in modules, so I'm really grateful. By using this module, I / O can be performed on Excel. openpyxl is especially useful, so I would like to continue using it positively in the future. problem ・ This tool cannot be shared with people who do not have Python installed.

4. tkinter edition

We aimed to develop it further and make it a GUI application that works by inputting characters in the frame and outputs the lane payout table as an Excel file. Actually, I used Python's tkinter module (not tinder). I had no prerequisite knowledge, so I felt like I was just googled, but I learned a lot. It was completed as a GUI application by converting the written Python source code into an exe file using pyinstaller. Now even people who can't use Python can use the tool. ScreenShot.png ↑ If you enter something like this ... ScreenShot_Product.png ↑ It is output as an Excel file like this.

The name list is taken from the 2019 PBA prize rankings. It's a dream-like tournament.

Finished product

The completed application can be downloaded from here (Dropbox). Please play with it.

Finally

Thank you for reading until the end. Actually, I thought about turning this tool into a web application, but I gave up for the time being because I had no knowledge of html. I will report again if I challenge html.

Extra edition

In parallel with the implementation of this tool, we also started the Atcoder programming contest. Competitive programming was useful! I hear something like this, but it is useful for getting used to the basic handling of lists, etc., and I feel that the content up to the first half of green is also useful for the real life of non-information people.

[^ 1]: Easy Python (Mana Takahashi, SB Creative), This book was easy to understand despite its name, and I recommend it.

Recommended Posts

Business efficiency starting from scratch with Python
Python starting with Windows 7
GRPC starting with Python
Microservices with GCP on RoR starting from scratch
Image processing from scratch with python (5) Fourier transform
Image processing from scratch with python (4) Contour extraction
Machine learning starting from scratch (machine learning learned with Kaggle)
Django starting from scratch (part: 1)
Reinforcement learning starting with Python
Python starting with Hello world!
With skype, notify with skype from python!
Call C from Python with DragonFFI
Using Rstan from Python with PypeR
Install Python from source with Ansible
Create folders from '01' to '12' with python
Run Aprili from Python with Orange
Call python from nim with Nimpy
Data analysis starting with python (data visualization 1)
Read fbx from python with cinema4d
Data analysis starting with python (data visualization 2)
Re: Life in Heroku starting from scratch with Flask ~ PhantomJS to Heroku ~
Collecting information from Twitter with Python (Twitter API)
System trading starting with Python3: long-term investment
Let Code Day75 starting from scratch "15.3 Sum"
Receive textual data from mysql with python
Get html from element with Python selenium
[Note] Get data from PostgreSQL with Python
Play audio files from Python with interrupts
Create wordcloud from your tweet with python3
"Python AI programming" starting from 0 for windows
Tweet from python with Twitter Developer + Tweepy
Let Code Day 29 "46. Permutations" starting from scratch
Decrypt files encrypted with openssl from python with openssl
Working with Azure CosmosDB from Python Part.2
Image acquisition from camera with Python + OpenCV
Getting started with Dynamo from Python boto
Try calling Python from Ruby with thrift
Scraping from an authenticated site with python
Data analysis starting with python (data preprocessing-machine learning)
"First Elasticsearch" starting with a python client
Use C ++ functions from python with pybind11
Re: Life in Heroku starting from scratch with Flask ~ Selenium & PhantomJS & Beautifulsoup ~
Let Code Day 27 "101. Symmetric Tree" starting from scratch
Collecting information from Twitter with Python (Environment construction)
FizzBuzz with Python3
Csv output from Google search with [Python]! 【Easy】
Scraping with Python
Machine learning starting with Python Personal memorandum Part2
Extract text from PowerPoint with Python! (Compatible with tables)
Statistics with python
Modern typing starting from Python 3.8 vol.1 (without class)
Scraping with Python
Python explosive environment construction starting from zero (Mac)
Python with Go
Machine learning starting with Python Personal memorandum Part1
Twilio with Python
Let Code Day 25 "70. Climbing Stairs" starting from scratch
Wrap C with Cython for use from Python
Play with 2016-Python
sql from python
Deep Learning from scratch The theory and implementation of deep learning learned with Python Chapter 3