2 Ревизии c0885357ac ... 4df1de369d

Автор SHA1 Съобщение Дата
  vaeringjar 4df1de369d Save rpg characters. преди 4 месеца
  vaeringjar 18e2718136 Save all experiments. преди 4 месеца

+ 17 - 1
src/blog/src/archive/ttrpg/harvey_js_alansbarn.org

@@ -357,7 +357,7 @@ I missed this one.
 - Remember that Brother John and I are both secretly members of the
   Zhentarim because of our dealings with Halia Thornton in Phandalin
 - Brother John carries a coin with the spread wings of a diving dragon
-  (like in the discord images)
+  (like in the discord images from 2023-03-27)
 - We go to the River's Mouth Tavern
 
 
@@ -371,6 +371,22 @@ I missed this one.
 - We fight a bunch of kobals, a ghost, and a brain zombie in a cave.
 
 
+** 2024-05-24 - Session #46?
+
+- We go to a pub. Everyone is convinced Brother John is a traitor.
+- During that time, my eyes go black light purple and starts a detect
+  magic ritual while holding an untouched pint.
+- I hand off the pint to Garret.
+- We meet w/ the speaker. They give us 1500 gold, some vials of
+  whatever (greater healing potions), and a wizards book of
+  necromancy.
+- We make it to Goodmjod.
+- Lots of chatter with drunk people and the bar keep.
+- We head out to find the crashed site of what some claim was a
+  commet.
+- It's probably a spelljammer.
+
+
 * Footnotes
   :PROPERTIES:
   :CUSTOM_ID: footnotes

+ 91 - 0
src/blog/src/archive/ttrpg/signe_alansbarn.org

@@ -0,0 +1,91 @@
+#+TITLE: HoHS Signe Alansbarn
+#+DATE: <2020-06-05 Fri 19:00>
+#+AUTHOR: vaeringjar
+#+EMAIL: vaeringjar@land
+#+DESCRIPTION: A new player character for high fantasy ttrpgs.
+#+KEYWORDS: ttrpg
+#+OPTIONS: toc:auto
+
+
+* Background
+
+I've imported this PC. The date isn't actually the time of writing,
+but rather just circa when I think I used her for a one shot, plus or
+minus 1 month.
+
+* About
+
+- Signe Alansbarn
+- Level 5
+- HP 43
+- HD 5d6
+- Arcana, Deception
+- Draconic Bloodline
+- Green Dragon
+- Twinned Spell
+- Quickened Spell
+- Feat: Spell Sniper w/ Eldritch Blast
+- Base: 8, 10, 14, 12, 13, 15
+- Allocated: 10, 10, 14, 12, 13, 16
+- Haunted One
+- Investigation, Survival
+- Primordial, [One unclaimed language]
+- Draconic (included)
+
+** Inventory
+
+- Dagger of Warning
+- Pot o'healing (greater)
+- Arcane focus
+- backpack
+- clothes
+- component pouch
+- dagger
+- dart
+- vial of drow poison
+- holy symbol
+- flask of holy water
+- steel mirror
+- flask of oil
+- piton (10)
+- poison, vial of basic (6)
+- poisoner's kit
+- purple worm poison
+- rations (10)
+- rope
+- wooden stake (9)
+- tinderbox (2)
+- waterskin
+- wyvern poison
+- a special silver coin (still a mystery, not included below)
+- 97 gold, 27 silver
+
+** Magic
+
+*** Cantrips
+
+- blade ward
+- create bonfire
+- eldritch blast
+- fire bolt
+- poinson spray
+- presto
+
+*** Spells
+
+4, 3, 2
+
+- magic missile
+- aganazzar's scorcher
+- misty step
+- dispell magic
+- haste
+- wall of water
+
+** Etc
+
+- breath weapon (green) once per SR
+- sorcery points 5 per LR
+- resistant to poison
+- advantage on init
+- save prof CON, CHA

+ 95 - 0
src/experiments/src/2024/algo/src/algo/colouring.py

@@ -0,0 +1,95 @@
+def get_largest_neighbour(graph):
+    """If there is a tie, it will return the first one it finds."""
+    max_key = None
+    max_length = 0
+
+    for key, edges in graph.items():
+        if len(edges) > max_length:
+            max_length = len(edges)
+            max_key = key
+
+    return max_key
+
+
+def get_edges(graph):
+    unique_values = set()
+
+    for node, edges in graph.items():
+        unique_values.update(edges)
+
+    return sorted(list(unique_values))
+
+
+def check_colouring(graph, node_colours):
+    edges = get_edges(graph)
+    success = True
+    for current in edges:
+        nodes = list(current)
+        if node_colours.get(nodes[0]) == node_colours.get(nodes[1]):
+            success = False
+
+    return success
+
+
+def find_colouration(graph):
+    vertices = list(graph.keys())
+    largest_neighbour = get_largest_neighbour(graph)
+    max_neighbours = graph.get(largest_neighbour, "")
+    d_neighbours = len(max_neighbours)
+    k_number = 1 + d_neighbours
+
+    node_colours = {key: None for key in graph}
+    possible_colours = list(range(1, k_number + 1))
+    available_colours = {key: possible_colours[:] for key in graph}
+    for vertex in vertices:  # each node in the graph
+        pop_colour = available_colours[vertex].pop()
+        node_colours[vertex] = pop_colour
+        edges = graph.get(vertex)
+        for current in edges:  # each neighbour
+            nodes = list(current)
+            # each node in the edge; will always be just 2
+            for node in nodes:
+                if pop_colour in available_colours[node]:
+                    available_colours[node].remove(pop_colour)
+
+    return node_colours, k_number, d_neighbours
+
+
+# def colour_clock(clock, count):
+#     time = count % clock
+#     return clock if time == 0 else time
+
+
+# def find_colouration_alt1(graph):
+#     # vertices = list(graph.keys())  # not using
+#     edges = get_edges(graph)
+#     largest_neighbour = get_largest_neighbour(graph)
+#     max_neighbours = graph.get(largest_neighbour, "")
+#     d_neighbours = len(max_neighbours)
+#     k_number = 1 + d_neighbours
+
+#     colour_count = 0
+#     node_colours = {key: None for key in graph}
+#     for current in edges:
+#         nodes = list(current)
+#         if node_colours.get(nodes[0]) is None:
+#             node_colours[nodes[0]] = colour_clock(
+#                 clock=k_number,
+#                 count=colour_count,
+#             )
+#             colour_count = colour_count + 1
+#         if node_colours.get(nodes[1]) is None:
+#             node_colours[nodes[1]] = colour_clock(
+#                 clock=k_number,
+#                 count=colour_count,
+#             )
+#             colour_count = colour_count + 1
+#         if node_colours.get(nodes[0]) == node_colours.get(nodes[1]):
+#             """This is either an edge case or it won't happen at all."""
+#             node_colours[nodes[1]] = colour_clock(
+#                 clock=k_number,
+#                 count=colour_count,
+#             )
+#             colour_count = colour_count + 1
+
+#     return node_colours, k_number, d_neighbours

+ 249 - 0
src/experiments/src/2024/algo/tests/algo_tests/test_colouring.py

@@ -0,0 +1,249 @@
+from unittest import TestCase
+
+from algo.colouring import (
+    check_colouring,
+    find_colouration,
+    get_edges,
+    get_largest_neighbour,
+)
+
+
+class TestColouring(TestCase):
+    def test_get_largest_neighbour(self):
+        graph = {
+            "A": ["AB", "AC"],
+            "B": ["AB", "BC", "BD"],
+            "C": ["AC", "BC", "CD"],
+            "D": ["BD", "CD"],
+        }
+        expected = "B"
+        results = get_largest_neighbour(graph)
+        self.assertEqual(results, expected)
+
+    def test_get_edges(self):
+        graph = {
+            "A": ["AB", "AC"],
+            "B": ["AB", "BC", "BD"],
+            "C": ["AC", "BC", "CD"],
+            "D": ["BD", "CD"],
+        }
+        expected = sorted(["AB", "AC", "BC", "CD", "BD"])
+        results = get_edges(graph)
+        self.assertEqual(results, expected)
+
+    def test_get_edges2(self):
+        graph = {
+            "A": ["AB"],
+            "B": ["AB"],
+        }
+        expected = sorted(["AB"])
+        results = get_edges(graph)
+        self.assertEqual(results, expected)
+
+
+class TestCheckColouring(TestCase):
+    def test_check_colouring_fail(self):
+        graph = {
+            "A": ["AB"],
+            "B": ["AB", "BC"],
+            "C": ["BC", "CD"],
+            "D": ["CD", "DE"],
+            "E": ["DE", "EF"],
+            "F": ["EF", "FG"],
+            "G": ["FG", "GH"],
+            "H": ["GH"],
+        }
+        node_colours = {
+            "A": 3,
+            "B": 3,
+            "C": 2,
+            "D": 3,
+            "E": 1,
+            "F": 2,
+            "G": 3,
+            "H": 1,
+        }
+        success = check_colouring(graph, node_colours)
+        self.assertTrue(success is False)
+
+    def test_check_colouring(self):
+        graph = {
+            "A": ["AB"],
+            "B": ["AB", "BC"],
+            "C": ["BC", "CD"],
+            "D": ["CD", "DE"],
+            "E": ["DE", "EF"],
+            "F": ["EF", "FG"],
+            "G": ["FG", "GH"],
+            "H": ["GH"],
+        }
+        node_colours = {
+            "A": 3,
+            "B": 1,
+            "C": 2,
+            "D": 3,
+            "E": 1,
+            "F": 2,
+            "G": 3,
+            "H": 1,
+        }
+        success = check_colouring(graph, node_colours)
+        self.assertTrue(success)
+
+
+class TestFindColouration(TestCase):
+    def test_find_colouration_empty_graph(self):
+        graph = {}
+        expected = ({}, 1, 0)
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+
+    def test_find_colouration1(self):
+        graph = {
+            "A": ["AB"],
+            "B": ["AB"],
+        }
+        expected = (
+            {
+                "A": 2,
+                "B": 1,
+            },
+            2,
+            1,
+        )
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+        success = check_colouring(graph, results[0])
+        self.assertTrue(success)
+
+    def test_find_colouration2(self):
+        graph = {
+            "A": ["AB", "AC"],
+            "B": ["AB"],
+            "C": ["AC"],
+        }
+        expected = (
+            {
+                "A": 3,
+                "B": 2,
+                "C": 2,
+            },
+            3,
+            2,
+        )
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+        success = check_colouring(graph, results[0])
+        self.assertTrue(success)
+
+    def test_find_colouration3(self):
+        graph = {
+            "A": ["AB", "AC"],
+            "B": ["AB", "BC", "BD"],
+            "C": ["AC", "BC", "CD"],
+            "D": ["BD", "CD"],
+        }
+        expected = (
+            {
+                "A": 4,
+                "B": 3,
+                "C": 2,
+                "D": 4,
+            },
+            4,
+            3,
+        )
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+        success = check_colouring(graph, results[0])
+        self.assertTrue(success)
+
+    def test_find_colouration4(self):
+        graph = {
+            "A": ["AB", "AC", "AD", "AE"],
+            "B": ["AB", "BC"],
+            "C": ["AC", "BC"],
+            "D": ["AD"],
+            "E": ["EF", "EG", "EH", "AE"],
+            "F": ["EF", "FG"],
+            "G": ["EG", "FG"],
+            "H": ["EH"],
+        }
+        expected_colours = {
+            "A": 5,
+            "B": 4,
+            "C": 3,
+            "D": 4,
+            "E": 4,
+            "F": 5,
+            "G": 3,
+            "H": 5,
+        }
+        expected_number = 5
+        expected_neighbours = 4
+        node_colours, k_number, d_neighbours = find_colouration(graph)
+        self.assertEqual(node_colours, expected_colours)
+        self.assertEqual(k_number, expected_number)
+        self.assertEqual(d_neighbours, expected_neighbours)
+        success = check_colouring(graph, node_colours)
+        self.assertTrue(success)
+
+    def test_find_colouration5(self):
+        graph = {
+            "A": ["AB", "AH"],
+            "B": ["AB", "BC"],
+            "C": ["BC", "CD"],
+            "D": ["CD", "DE"],
+            "E": ["DE", "EF"],
+            "F": ["EF", "FG"],
+            "G": ["FG", "GH"],
+            "H": ["AH", "GH"],
+        }
+        expected = (
+            {
+                "A": 3,
+                "B": 2,
+                "C": 3,
+                "D": 2,
+                "E": 3,
+                "F": 2,
+                "G": 3,
+                "H": 2,
+            },
+            3,
+            2,
+        )
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+        success = check_colouring(graph, results[0])
+        self.assertTrue(success)
+
+    def test_find_colouration6(self):
+        graph = {
+            "A": ["AB"],
+            "B": ["AB", "BC"],
+            "C": ["BC", "CD"],
+            "D": ["CD", "DE"],
+            "E": ["DE", "EF"],
+            "F": ["EF", "FG"],
+            "G": ["FG", "GH"],
+            "H": ["GH"],
+        }
+        expected = (
+            {
+                "A": 3,
+                "B": 2,
+                "C": 3,
+                "D": 2,
+                "E": 3,
+                "F": 2,
+                "G": 3,
+                "H": 2,
+            },
+            3,
+            2,
+        )
+        results = find_colouration(graph)
+        self.assertEqual(results, expected)
+        success = check_colouring(graph, results[0])
+        self.assertTrue(success)

+ 25 - 0
src/experiments/src/2024/django_client_test_with_dynaconf/.gitignore

@@ -0,0 +1,25 @@
+# Forget these =P
+
+
+$RECYCLE.BIN/
+*.dat
+*.egg-info
+*.out
+*.pyc
+*~
+.DS_Store
+.coverage
+Desktop.ini
+Thumbs.db
+ehthumbs.db
+
+
+.config/
+.python-version
+poetry.lock
+var/
+
+
+# Ignore dynaconf secret and local files in working dir
+/.secrets.*
+/*.local.*toml

+ 3 - 0
src/experiments/src/2024/ml/.gitignore

@@ -0,0 +1,3 @@
+.coverage
+.python-version
+poetry.lock

+ 12 - 0
src/experiments/src/2024/ml/Makefile

@@ -0,0 +1,12 @@
+NAME=ml
+
+
+.PHONY: dev
+dev:
+	@py3clean src tests
+	@ruff check --select I --fix .
+	@ruff format .
+	@ruff check .
+	@coverage run --source='.' -m unittest discover -s tests.$(NAME)_tests -t .
+	@coverage report -m
+	@py3clean src tests

+ 3 - 0
src/experiments/src/2024/ml/README.org

@@ -0,0 +1,3 @@
+* stub
+
+These are completely incomplete dabblings and saving for various thoughts.

+ 30 - 0
src/experiments/src/2024/ml/pyproject.toml

@@ -0,0 +1,30 @@
+[tool.poetry]
+name = "ml"
+version = "0.1.0"
+description = ""
+authors = ["vaeringjar <vaeringjar@peers.community>"]
+
+
+[tool.poetry.dependencies]
+python = "^3.9"
+numpy = "^2.0.0"
+matplotlib = "^3.9.1"
+seaborn = "^0.13.2"
+scikit-learn = "^1.5.1"
+
+
+[tool.poetry.group.dev.dependencies]
+coverage = "^7.4.0"
+pyclean = "^2.7.6"
+ruff = "^0.1.13"
+
+
+[tool.isort]
+profile = "black"
+skip_gitignore = true
+skip = [".venv"] # just in case the host doesn't have git
+
+
+[build-system]
+requires = ["poetry-core"]
+build-backend = "poetry.core.masonry.api"

+ 0 - 0
src/experiments/src/2024/ml/src/ml/__init__.py


Някои файлове не бяха показани, защото твърде много файлове са промени