Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions bot/exts/fun/kenken.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from collections.abc import Iterator

Check failure on line 1 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:1:29: F401 `collections.abc.Iterator` imported but unused
from dataclasses import dataclass

Check failure on line 2 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:2:25: F401 `dataclasses.dataclass` imported but unused
from random import randint, random

Check failure on line 3 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:3:29: F401 `random.random` imported but unused

Check failure on line 3 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:3:20: F401 `random.randint` imported but unused

import discord

Check failure on line 5 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:5:8: F401 `discord` imported but unused
from discord.ext import commands
from pydis_core.utils.logging import get_logger

Check failure on line 7 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:7:38: F401 `pydis_core.utils.logging.get_logger` imported but unused

from bot.bot import Bot
from bot.constants import Client

Check failure on line 10 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:10:27: F401 `bot.constants.Client` imported but unused
from bot.utils.converters import CoordinateConverter

Check failure on line 11 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:11:34: F401 `bot.utils.converters.CoordinateConverter` imported but unused
from bot.utils.exceptions import UserNotPlayingError

Check failure on line 12 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (F401)

bot/exts/fun/kenken.py:12:34: F401 `bot.utils.exceptions.UserNotPlayingError` imported but unused

class Kenken(commands.Cog):

Check failure on line 14 in bot/exts/fun/kenken.py

View workflow job for this annotation

GitHub Actions / lint / Run linting & tests

Ruff (I001)

bot/exts/fun/kenken.py:1:1: I001 Import block is un-sorted or un-formatted
"""Play a game of Kenken."""

def __init__(self, bot: Bot):
self.bot = bot

@commands.group(name="Kenken", invoke_without_command=True)
async def kenken_group(self, ctx: commands.Context) -> None:
"""Commands for Playing Kenken."""
await ctx.send("The Kenken API is working!")

async def setup(bot: Bot) -> None:
"""Load the Kenken cog."""
await bot.add_cog(Kenken(bot))
25 changes: 25 additions & 0 deletions bot/exts/fun/mathdoku.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

class Cell:
"""Represents a single cell in the grid."""

def __init__(self, column: int, row: int) -> None:
self.column = column
self.row = row

class Block:
"""Represents a block in the puzzle, with its cells, operation and colour."""

def __init__(self, cells: list[Cell], label: str, label_cell: Cell, colour: tuple[int, int, int]) -> None:
self.cells = cells
self.label = label
self.label_cell = label_cell
self.colour = colour

class Grid:
"""Represents the full game board, with all blocks and player guesses."""

def __init__(self, size: int, blocks: list[Block]) -> None:
self.size = size
self.blocks = blocks
self.guesses: dict[tuple[int, int], int] = {}
self.cell_block_map: dict[tuple[int, int], Block] = {}
244 changes: 244 additions & 0 deletions bot/resources/fun/mathdoku_boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
5x5:d5
.KK "1:(d=5)"
EAACC
EB3CG
EBF5G
E1FDD
FFFD5

A 1-
B 6+
C 12x
D 8+
E 30x
F 15+
G 3-

1 5 4 3 2
5 4 3 2 1
3 2 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