|
1 | | -# RUMMY |
2 | | -An attempt to make a simple CLI version of the card game-Rummy. |
3 | | -Another Odd day at College, my hostel neighbor came up to me and gave me a task,"Hey Dude, Can you code Rummy??" |
4 | | -I was like, "Well that's interesting! Lemme give it a try...." |
5 | | -And so we have this!!😁 |
| 1 | +# Rummy |
6 | 2 |
|
7 | | -P.S.- I have never really played any card came so if there's any fishy game logic, feel free to raise issues, |
8 | | -suggestions are always welcome. |
| 3 | +A modular Python implementation of the classic Rummy card game, refactored for agent-based play and reinforcement-learning experiments. |
9 | 4 |
|
10 | | -To run the program download the python script, navigate to the downloaded directory and run the following command:<br> |
11 | | -<br> |
12 | | -python rummy.py |
| 5 | +This repository turns a single legacy script into an importable package (`rummy/`) with clear separation for: |
13 | 6 |
|
| 7 | +- Card definitions and helpers (rummy/cards.py) |
| 8 | +- Deck and discard pile management (rummy/deck.py) |
| 9 | +- Game rules and meld validation (rummy/game.py) |
| 10 | +- A simple RL-style environment wrapper (rummy/env.py) |
| 11 | +- A small random agent example (rummy/agents.py) |
| 12 | + |
| 13 | +Why this project |
| 14 | + |
| 15 | +- Make the Rummy game engine testable and importable for research or challenge tasks. |
| 16 | +- Provide a minimal environment API so agents can play without human input. |
| 17 | +- Include CI and tests so merges won't regress core behavior. |
| 18 | + |
| 19 | +Quick start (using uv) |
| 20 | + |
| 21 | +All startup, installs and test runs should use the provided uv environment wrapper from this directory. |
| 22 | + |
| 23 | +1. Open a shell in the repository root and change into the RUMMY folder: |
| 24 | + |
| 25 | + cd RUMMY |
| 26 | + |
| 27 | +2. Run tests and install dev deps (example): |
| 28 | + |
| 29 | + uv run python3 -m pip install --upgrade pip |
| 30 | + uv run python3 -m pip install pytest |
| 31 | + uv run python3 -m pytest -q |
| 32 | + |
| 33 | +3. Run the example entrypoint (small simulation): |
| 34 | + |
| 35 | + uv run python3 Rummy.py |
| 36 | + |
| 37 | +Package usage (importing in code) |
| 38 | + |
| 39 | +- From your Python code you can import the environment and game directly: |
| 40 | + |
| 41 | + from rummy.env import RummyEnv |
| 42 | + from rummy.game import RummyGame |
| 43 | + |
| 44 | +- Create an environment and reset to get the first observation: |
| 45 | + |
| 46 | + env = RummyEnv(["Alice", "Bob"], seed=42) |
| 47 | + obs = env.reset() |
| 48 | + |
| 49 | +Testing and CI |
| 50 | + |
| 51 | +- The repository contains unit tests under `tests/` that validate deck size, dealing, and meld/sequence validation. |
| 52 | +- A GitHub Actions workflow at `.github/workflows/python-app.yml` runs the tests on push and pull requests. |
| 53 | + |
| 54 | +Challenge notes |
| 55 | + |
| 56 | +This repo is intended as a small challenge: some rules and edge cases are intentionally simplified and there are three suggested issues for contributors to improve: |
| 57 | + |
| 58 | +- Fix winner detection and game-end flow |
| 59 | +- Improve meld and wildcard validation rules |
| 60 | +- Expand the RL observation/action API for agents |
| 61 | + |
| 62 | +Contributing |
| 63 | + |
| 64 | +- Open a PR with targeted changes and include/adjust tests to cover the change. |
| 65 | +- The CI workflow will run the test-suite automatically. |
| 66 | + |
| 67 | +License |
| 68 | + |
| 69 | +- This project is provided as-is for educational and challenge purposes. Add a license file if you want to publish it. |
0 commit comments