GithubHelp home page GithubHelp logo

balance_bots's Introduction

Balance Bots

This repo contains the solution to a coding challenge called "balance bots". The instructions for this challenge can be found in assignment.txt. It is written in Python because of the readability of the language, its built-in modules, and my familiarity with the language.

Requirements

Python version 3.9+ is required in order to run the code because of the type hinting style I used. No external modules are required.

Running the code

python src/balance_bots.py

Prints the answers to both questions in the assignment to your terminal. This should print 73 and 3965.

Running tests

python -m unittest

Runs all tests.

Notes

There are a few oddities in the code that you would likely not see in production code due to the nature of the assignment:

  • I added type hinting only where I felt like it improved readability and clarity rather than strictly adding it everywhere (or nowhere at all).
  • I went for a pragmatic approach when it comes to testing. I made isolated unit tests where feasible, but for some class methods (e.g. Fixture.run()) it was more convenient to just pass an entire fixture and verify the results.
  • I think the Factory init method looks messy, but I am currently drawing a blank on how to make it better. I would ask code reviewers for suggestions here.
  • In balance_bots.py I added if __name__ == "__main__": code so you can run the file to easily print the answers to your terminal.
  • I made test_assignment.py solely to verify the answers to the questions in the assignment. It does not test any code that is not already covered by other tests.

balance_bots's People

Contributors

markdentoom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.