Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mukybaby/Simple-Shop-Sim/llms.txt

Use this file to discover all available pages before exploring further.

Simple Shop Sim is intentionally small and hackable. The README explicitly encourages patching bugs and extending the code — everything you need to change lives in two JSON files and a handful of Python functions. The sections below walk through the most common modifications.

Adding new items

Open res/items.json and append a new [name, price] entry. The game loads this file fresh on every launch, so no Python changes are required.
[
  ["Apple", 5],
  ["Bread", 10],
  ["Potion", 25],
  ["Sword", 75],
  ["Shield", 50]
]
Every item loaded from this file starts with a stock of 5 — that value is hardcoded in main.py. If you want a different initial stock for new items, see Changing initial stock below.

Adding customer names

Open res/customer_names.json and append additional name strings to the array. The pool is sampled by make_customers() every time the shop opens for a new day. More names are required for longer playthroughs — customer count grows as day × 3, so Day 10 alone needs 30 distinct names. A good rule of thumb: aim for at least (target_max_day × 3) + 10 names in the pool.
[
  "Liam Johnson",
  "Emma Martinez",
  "Noah Smith",
  "Your New Name Here"
]

Changing starting cash

The shop’s starting cash is set as the third argument to the Shop constructor in main.py:
# Original — starts with $100
shop = Shop(input("What do you want to name your shop?: "), [], 100)

# Modified — start with $500
shop = Shop(input("What do you want to name your shop?: "), [], 500)

Changing initial stock

The initial stock for every item loaded from items.json is the hardcoded 5 passed to the Item constructor in main.py:
# Change 5 to any starting quantity you prefer
shop.inventory.append(Item(item[0], item[1], 10))
Adjust the third argument to set a different quantity for all items at game start. If you want per-item control, consider adding a third element to each entry in items.json (e.g. ["Sword", 75, 2]) and reading item[2] here instead of a hardcoded value.

Known issues and suggested fixes

The following bugs exist in the current source. Each accordion explains the problem and shows a corrected snippet.
Location: main.py, inside the case "2" branch.The comment says the successful bargain applies a 10% markup, but the formula price += price * 0.9 actually increases the price by 90%:
# Buggy: increases price by 90%, not 10%
customer.wants.price += customer.wants.price * 0.9  # Apply a 10% markup to the price
Fix: Replace the multiplier with 0.1:
# Corrected: apply a true 10% markup
customer.wants.price += customer.wants.price * 0.1
Location: res/shop.py, inside make_customers().The guard is intended to prevent the same name appearing twice in one day’s roster:
# Buggy: compares a string against a list of Customer objects — always False
while new_customer_name in customers:
    new_customer_name = random.choice(customers_name)
Because customers holds Customer objects rather than strings, the in check never evaluates to True and duplicate names can slip through.Fix: Track used names in a separate list:
used_names = []
while len(customers) != total_customers:
    new_customer_name = random.choice(customers_name)
    while new_customer_name in used_names:
        new_customer_name = random.choice(customers_name)
    used_names.append(new_customer_name)
    new_customer = Customer(
        new_customer_name,
        random.randint(17, 286),
        random.choice(shop.inventory),
        random.uniform(0, 100),
        shop,
    )
    customers.append(new_customer)
Location: main.py, inside the case "1" branch.The guard is meant to prevent a restock the player can’t afford, but it compares the raw quantity against shop.cash rather than the total cost:
# Buggy: compares quantity (e.g. 3 units) directly to cash (e.g. $100)
if stock_choice > shop.cash:
    print("You dont have enough cash")
A player with $100 could buy 3 units of a Potion (price $25 each, total $75) — that is correctly allowed. But they could also “buy” 5 units for a total cost of $125, because 5 > 100 is False and the guard does not fire, yet $125 exceeds the available $100. The true cost is never checked.Fix: Multiply by the item’s price before comparing:
# Corrected: check total restock cost against available cash
if stock_choice * item.price > shop.cash:
    print("You don't have enough cash")
These fixes are community suggestions based on a close reading of the source code. The project is open source — feel free to fork the repository and submit a pull request with your patches.

Build docs developers (and LLMs) love