Skip to content

Remove duplicate code in RLCard environments #1282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 14, 2025

Conversation

dm-ackerman
Copy link
Contributor

Description

The RLCard envs had duplicate functions - step, get_image, get_font, calculate_height, calculate_width, calculate_offset. These were repeated in most/all files and identical. They are now in a utils file and imported as needed.
Additionally, TexaHold'em and no limit TexasHold'em were nearly identical code. One now is a child class of the other to remove duplicate code.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have run pytest -v and no errors are present.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I solved any possible warnings that pytest -v has generated that are related to my code to the best of my knowledge.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

These functions were identical in all envs. They have been moved to
single file and imported into the envs.
These were the same code in multiple files, they are now in a single
file and imported as needed.
The base rlcard env already has a step() function. The envs just called
that with an added render call. The render call was added to the base
step() function.
Almost all of Texas Hold'em and the no limit version are the same. This
makes one a subclass of the other to remove duplicate code.
This isn't an enviornment file, it should be ignored when making env
docs.
@David-GERARD David-GERARD self-assigned this Apr 14, 2025
@David-GERARD David-GERARD added bug Something isn't working enhancement New feature or request labels Apr 14, 2025
@David-GERARD David-GERARD added this to the 1.25 release milestone Apr 14, 2025
@David-GERARD David-GERARD merged commit cd09367 into Farama-Foundation:master Apr 14, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants