Inspiration

The four of us have enjoyed playing the game of Cricket against one another as a game of strategy and precision. However, when one goes to practice it is oftentimes difficult to gain the same competitive experience from playing against another human opponent. We wanted to create a computer engine not only plays like a human but is also able to show where it shot each turn.

What it does

The Darts Engine is a python command-line program that is able to track a two-player game of cricket with the option of two human players or one human and a computer player. The computer can be set to difficulties ranging from 1-100 where level 100 is the most difficult.

The goal of cricket is to "close out" all numbers from 15 to bullseye and score more points than your opponent. A player closes out a number by scoring that number three times, either by hitting that section three times, or with a double or triple multiplier. If a number is closed for one player, but not the other, the player who closed the number is able to score points on that number by hitting it again. The points returned for this is simply the value of the region hit. That player can score on that region until the other player closes the region, at which point no one can score on it anymore. The game ends once the player that leads in points closes all regions. If the trailing player closes all values first, the game ends once the second player also closes all values on the board, or if the trailing player overtakes the leading player in points.

At the end of a game against the computer, a graphic of the dart board is displayed containing points representing the position of every shot taken by the computer during the game.

How we built it

This program was built using python back-end programming. In order to run the game the board state of both players is stored as an array of integers representing the number of times a significant region has been hit as well as the relevant player's score. The turn is passed back and forth between the two players with each turn consisting of three throws. When the computer is signaled to take a shot a series of calculations are made using a normal distribution around a calculated target point based off of one of three possible strategies.

Challenges we ran into

The main challenge we ran into was creating a front-end representation of the program. We first attempted to use Django to create a website where the game would be hosted. However, this proved to be more difficult than expected to learn within the 24-hour time period. We then tried to pivot to a GUI representation but were also unable to properly implement our vision within the time remaining. This was our team's first time using git and GitHub which presented an early challenge which we were able to overcome after many struggles. As this was our team's first collaborative programming project we initially faced difficulties effectively dividing up work, but, we were quickly able to work together to achieve this final product.

Accomplishments that we're proud of

  1. We were most proud that we were able to produce a to-scale dart board graphic with precise scoring that properly represents a real-life dart board. We used this to visualize any number of shots taken by the computer to not only produce single value output but a story behind the game.
  2. We are very proud of our ability take a project from the idea stage to a completed product. It took us an unexpectedly long time to come up with a our vision for this project, but once we found it we had no issues sticking to that vision.
  3. We were also proud of how well we were able to merge together the game engine with the AI logic. We worked on both of these parts separately with minimal crossover and found communication strategies that allowed our group to work together effectively.

What we learned

  1. Managing project scope and project expectations
  2. Version control through github
  3. Using numpy and matplotlib to create plots
  4. Programming together as a team and dividing up work

What's next for Darts Engine

In the idea generation stage, we envisioned our idea as a graphical application, that could ideally run from a web-browser. This turned out to be too ambitious given the 24-hour time constraint, so we settled on a command line application for the time being. This marks a point where our team can continue to make progress on this project, even after the hackathon has finished. Additional ways we could make improvements include asynchronous play between 2 human players, the development of a calibrated ghost of a player trained on the past performance of a human player, or support for other dart games like 301.

All in all, our darts engine provides a robust way to track the game of cricket, while also enabling a more human-like computer opponent. Thank you to Hoo-Hacks for running the event, and we hope that you will consider our project for the art and gaming category.

Built With

Share this project:

Updates