Skip to content

Commit

Permalink
Feat/refactor 2 (#58)
Browse files Browse the repository at this point in the history
* Refactor max_coal assignment to use unwrap_or_else()

* Refactor Workspace

* Update .readthedocs.yaml and CONTRIBUTING.md files

* Refactor _socha function in lib.rs

* Remove unused test function

* Refactor variable name in game_state.rs

* Update CartesianCoordinate::new to be a const function

* Fix mutable reference in perform function
  • Loading branch information
maxblan authored Mar 16, 2024
1 parent 0f73e46 commit bf81e1c
Show file tree
Hide file tree
Showing 31 changed files with 627 additions and 448 deletions.
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ sphinx:
fail_on_warning: false

# Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
python-requirements:
install:
- requirements: docs/requirements.txt
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
45 changes: 28 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<!-- omit in toc -->

# Contributing to Software-Challenge Python Client

First off, thanks for taking the time to contribute! ❤️

All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉

> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
>
> - Star the project
> - Refer this project in your project's readme
<!-- omit in toc -->

## Table of Contents

- [Code of Conduct](#code-of-conduct)
Expand All @@ -22,18 +25,16 @@ All types of contributions are encouraged and valued. See the [Table of Contents
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)


## Code of Conduct

This project and everyone participating in it is governed by the
[Software-Challenge Python Client Code of Conduct](https://github.com/FalconsSky/socha-python-clientblob/master/CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report unacceptable behavior
to .


## I Have a Question

> If you want to ask a question, we assume that you have read the available [Documentation]().
> If you want to ask a question, we assume that you have read the available Documentation.
Before you ask a question, it is best to search for existing [Issues](https://github.com/FalconsSky/socha-python-client/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.

Expand Down Expand Up @@ -63,17 +64,19 @@ Depending on how large the project is, you may want to outsource the questioning
## I Want To Contribute

> ### Legal Notice <!-- omit in toc -->
>
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
### Reporting Bugs

<!-- omit in toc -->

#### Before Submitting a Bug Report

A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.

- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)).
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the documentation. If you are looking for support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/FalconsSky/socha-python-clientissues?q=label%3Abug).
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
Expand All @@ -84,16 +87,18 @@ A good bug report shouldn't leave others needing to chase you up for more inform
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?

<!-- omit in toc -->

#### How Do I Submit a Good Bug Report?

> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to .
<!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->

We use GitHub issues to track bugs and errors. If you run into an issue with the project:

- Open an [Issue](https://github.com/FalconsSky/socha-python-client/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.

Once it's filed:
Expand All @@ -104,20 +109,21 @@ Once it's filed:

<!-- You might want to create an issue template for bugs and errors that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->


### Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for Software-Challenge Python Client, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.

<!-- omit in toc -->

#### Before Submitting an Enhancement

- Make sure that you are using the latest version.
- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Read the documentation carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/FalconsSky/socha-python-client/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.

<!-- omit in toc -->

#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://github.com/FalconsSky/socha-python-client/issues).
Expand All @@ -131,6 +137,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/Falcon
<!-- You might want to create an issue template for enhancement suggestions that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->

### Your First Code Contribution

- Familiarize yourself with the project: Before you make your first contribution, take some time to understand the project and its goals. Read through the documentation and the source code to get a feel for the project structure and coding style.

- Find an issue to work on: Look through the open issues in the project's repository to find something that interests you or that you feel you can tackle. If you can't find an issue that suits your skills, consider creating a new issue to suggest a feature or fix a bug.
Expand Down Expand Up @@ -172,6 +179,7 @@ By following these steps, you can make your first code contribution to a project
By making improvements to the documentation, you can help others understand and use the project more easily. Your contributions will be invaluable in making the project a success!

## Styleguides

The following styleguides should be followed when contributing code to this project:

- PEP 8: Follow the guidelines set forth in the Python Enhancement Proposal 8 (PEP 8) for code style, including indentation, line length, naming conventions, and whitespace usage.
Expand All @@ -187,27 +195,30 @@ The following styleguides should be followed when contributing code to this proj
By following these styleguides, you can help maintain a consistent and high-quality codebase for this project.

### Commit Messages

- Use the present tense: Write your commit messages in the present tense, using phrases like "change" or "add" instead of "changed" or "added".

- Follow the Karma Runner format: Use the following format for your commit messages: `<type>(<scope>): <subject>`.
The `<type>` should describe the nature of the change (e.g. `fix`, `feat`, `docs`, `style`, etc.). The `<scope>` should describe the part of the code affected by the change,
- Follow the Karma Runner format: Use the following format for your commit messages: `<type>(<scope>): <subject>`.
The `<type>` should describe the nature of the change (e.g. `fix`, `feat`, `docs`, `style`, etc.). The `<scope>` should describe the part of the code affected by the change,
and the `<subject>` should provide a brief description of the change.

- Limit the subject line to 72 characters: Keep the subject line of your commit message concise and to the point, using no more than 72 characters.

- Provide more detail in the body: If necessary, provide additional detail about the changes in the body of the commit message,
- Provide more detail in the body: If necessary, provide additional detail about the changes in the body of the commit message,
separated from the subject line by a blank line.

- Reference issues: If your changes are related to a specific issue or bug, include a reference to that issue in your commit message.

Example:
```
fix(authentication system): validate users before logging in

The authentication system was failing to properly validate users, causing them to be unable to log in.
This change adds additional checks to the authentication process to ensure that users are correctly validated.
```text
fix(authentication system): validate users before logging in
The authentication system was failing to properly validate users, causing them to be unable to log in.
This change adds additional checks to the authentication process to ensure that users are correctly validated.
Fixes #123.
```

Fixes #123.
```
By following the Karma Runner convention for commit messages, you can make it easier for others to understand the changes you've made and why.
By following the Karma Runner convention for commit messages, you can make it easier for others to understand the changes you've made and why.
This will help maintain the project's history and make it easier for others to contribute to the project in the future.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- trunk-ignore-all(markdownlint/MD041) -->
<a target="_blank" rel="noopener noreferrer" href="https://www.software-challenge.de"><p align="center"><img width="128" src="https://software-challenge.de/site/themes/freebird/img/logo.png" alt="Software-Challenge Logo"></p></a>

# Python Client for the Software-Challenge Germany 2024
Expand All @@ -8,14 +9,11 @@
[![Discord](https://img.shields.io/discord/233577109363097601?color=blue&label=Discord)](https://discord.gg/ARZamDptG5)
[![Documentation](https://img.shields.io/badge/Software--Challenge%20-Documentation-%234299e1)](https://docs.software-challenge.de/)

> **Be warned!** This package is currently experimental and has still a few known bugs. But please try it out and let us know if anything comes up.
> Hey there! To help you out, it's best to start by checking out the
> [documentation for this client](https://socha-python-client.readthedocs.io/en/)
> before you ask any questions or open an issue.
> It'll provide you with some helpful information!

This repository contains the Python package for the
[Software-Challenge Germany](https://www.software-challenge.de), a programming competition for students. The students
have to develop an artificial intelligence that plays and competes against other opponents in an annually changing game.
Expand Down Expand Up @@ -244,17 +242,18 @@ my_player/
The `my_player` directory or whatever you named yours just needs to be packaged as a ZIP archive,
and your player is ready to be uploaded. Congratulations! 🥳🎉


## Local Development

> 🏗️ This part is currently still unfinished and subject to change.
This package was mostly written in Rust, which gives a significant performance boost compared to a natural Python program.
However, this leads to considerable effort, as so-called bindings have to be created. These allow Python to access the functions in Rust. To realize this, [PyO3](https://github.com/PyO3/pyo3) is used here with the help of [Maturin](https://github.com/PyO3/maturin).
However, this leads to considerable effort, as so-called bindings have to be created. These allow Python to access the functions in Rust. To realize this, [PyO3](https://github.com/PyO3/pyo3) is used here with the help of [Maturin](https://github.com/PyO3/maturin).

If local development is desired, the following things must be installed beforehand:

- [Rust Compiler with Cargo](https://www.rust-lang.org/tools/install),
- [Python 3.10 or later](https://www.python.org/downloads/),
- and [Maturin](https://github.com/PyO3/maturin) in a virtual environment in this repository.

If everything has been installed successfully, then the command `maturin develop` must be executed in a virtual environment.
Now you can use a logic written in Python and make changes in the Rust code. Each time a change is made, `maturin develop` must be executed again to make the change visible to the Python code.
Now you can use a logic written in Python and make changes in the Rust code. Each time a change is made, `maturin develop` must be executed again to make the change visible to the Python code.
Loading

0 comments on commit bf81e1c

Please sign in to comment.