re: AI
# Module: Iced Quinn, 2021
# Algorithm: Jeffrey Phillips Freeman, 2017
# https://jeffreyfreeman.me/hyperassociative-map-explanation/
import math, random
# chi: ideal distance between nodes
# sigma: how strong unrelated nodes repel one another; smaller is stronger
# nu: learning rate
# beta: alignment threshold; stop when movement in an iteration falls below this
# neighbors: any vertex connected by an edge to this one
# non-neighbor: other vertices who are not connected by an edge
# TODO don't take sqrts and use pre-squared values; saves time
const
Nu = 0.05
Beta = 0.005
type
Vertex* = object
x*, y*: float
edges*: seq[int]
Edge* = object
v1*, v2*: int
length*: float
Solver* = object
chi*, sigma*: float
vertices*: seq[Vertex]
edges*: seq[Edge]
rng*: Rand
func add*(self: var Solver; v: Vertex) {.inline.} =
self.vertices.add v
func add*(self: var Solver; e: Edge) {.inline.} =
self.edges.add e
self.vertices[e.v1].edges.add self.edges.high
self.vertices[e.v2].edges.add self.edges.high
func mag(s: varargs[float]): float =
result = 0
for k in s:
result += (k * k)
result = sqrt(result)
func relates(self: Edge; v: int): bool =
result = false
if self.v1 == v: return true
if self.v2 == v: return true
func opposite(self: Edge; v: int): int =
if v == self.v1: return self.v2
if v == self.v2: return self.v1
# TODO find proper exception
raise new_exception(Defect, "Vertex was not in edge")
func set_defaults*(self: var Solver) =
self.chi = 1
self.sigma = 2
func validate(self: Edge) =
assert self.length > 0
func validate(self: Solver) =
assert self.sigma > 1
func randomize(self: var Solver) =
# TODO somehow check if the randomizer is uninitialized, as that will cause an infinite lockup
for i in 0..<self.vertices.len:
self.vertices[i].x = self.rng.gauss()
self.vertices[i].y = self.rng.gauss()
iterator neighbors(self: Solver; vi: int): lent Vertex =
# yield only nodes which do share edges with v_i
for ei in self.vertices[vi].edges:
yield self.vertices[opposite(self.edges[ei], vi)]
iterator neighbors_edge(self: Solver; vi: int): (lent Vertex, float) =
# yield only nodes which do share edges with v_i
for ei in self.vertices[vi].edges:
yield
(self.vertices[opposite(self.edges[ei], vi)],
self.edges[ei].length)
iterator not_neighbors(self: Solver; vi: int): lent Vertex =
# yield only nodes which do not have edges with v_i
for i in 0..<self.vertices.len:
block mushroom:
for ei in self.vertices[i].edges:
if relates(self.edges[ei], vi): break mushroom
yield self.vertices[i]
func align(self: var Solver; vi: int): (float, float) =
var v = addr self.vertices[vi]
let px = v.x
let py = v.y
var dpx = 0.0
var dpy = 0.0
for (m, chi) in neighbors_edge(self, vi):
let qx = m.x - px
let qy = m.y - py
let q = mag(qx, qy)
dpx += qx * (((q - chi) * Nu) / q)
dpy += qy * (((q - chi) * Nu) / q)
for m in not_neighbors(self, vi):
let qx = m.x - px
let qy = m.y - py
let q = mag(qx, qy)
var cx = qx * (-Nu / (pow(q, self.sigma + 1)))
var cy = qy * (-Nu / (pow(q, self.sigma + 1)))
let c = mag(cx, cy)
if c > self.chi:
cx *= (self.chi / c)
cy *= (self.chi / c)
dpx += cx
dpy += cy
return (dpx, dpy)
func align_all(self: var Solver): float =
result = 0
for i in 0..<self.vertices.len:
var v = addr self.vertices[i]
let (dpx, dpy) = align(self, i)
let dp = mag(dpx, dpy)
if dp > result:
result = dp
v.x += dpx
v.y += dpy
func solve*(self: var Solver) =
validate(self)
debugecho "> randomizing"
randomize(self)
debugecho "> solving"
var i = 0
let target = Beta * self.chi
while true:
let energy = align_all(self)
inc i
debugecho i, ",", energy
if energy < target: break
# optional: could recenter the graph if you wanted
Here are two pictures from the inside, one shows the room with all the beds for all the villagers who are just waking up.
This is a picture of my animal trap outside I used to capture animals and eventually get them inside.
These pictures are several views from the roof of the structure and one of the view of the spiral staircase on the way down.
I revived an old #minecraft #game I played a few years ago. I didn't have any photos saved so I wanted to snatch some screenshots. If anyone wants to see more pictures I will reply with some bonus pictures.
The design was a glass "fortress" in the clouds. It has a glass spiral staircase going up to one block above the cloud line and then the structure is made of glass. It contains villagers, a gollum, a machine that automatically breeds and kills chickens for an endless supply of food, sheep, cows, and all the accessories. Has about 20 villagers, a portal, and is draped in lava and water flowing down.
There is also an extensive underground structure with mushrooms and other stuff. There is also a "trap" outside where world-spawned animals get trapped and then a gate to herd them into the interior of the structure. so I have several more animals (mostly llamas) trapped in an underground chamber.
The attached pictures are of the fortress from a few angles from the outside (more pictures in the replies)
Physics explains why humans can walk through crowded places and not spill their coffee – Physics World
https://physicsworld.com/physics-explain-why-humans-can-walk-through-crowded-places-and-not-spill-their-coffee/
They found that for weak oscillations, there was a sharp switch between in phase and antiphase control at the system’s resonant frequency – something that they said can be fully understood using linear systems control theory. For stronger oscillations, the duo discovered a transition region, rich in behaviour, where the motions of the cart and pendulum are not synchronized.
@freemo I've actually though the same since I was a kid because too many of them dismissed my symptoms which I had googled and found the cause but couldn't confirm until I was old enough to pay for tests they wouldn't give me because "google didn't go to medical school".
i pasted the rules here in a hedgedoc. the document is freely editable for everyone..if you want to make changes or add to it, feel free to ;-)
@freemo Tell me about it. I hate getting in discussions with people who don't understand logic well. It's necessary to try to make society a more reasonable place , but arguing with people who reason backwards (from conclusion first) or from emotion is incredibly frustrating.
@freemo
That's exactly where I heard it!
I just heard today that plants are made mostly of air, and a little water. Most of the structure of plants are carbon from CO2, and hydrogen from the rain. Just a very small amount is minerals from the soil.
@freemo
And almost 9 pounds of water ( if I did my math right)
Jeffrey Phillips Freeman
Innovator & Entrepreneur in Machine Learning, Evolutionary Computing & Big Data. Avid SCUBA diver, Open-source developer, HAM radio operator, astrophotographer, and anything nerdy.
Born and raised in Philadelphia, PA, USA, currently living in Utrecht, Netherlands, USA, and Thailand. Was also living in Israel, but left.
Pronouns: Sir / Mister
(Above pronouns are not intended to mock, i will respect any persons pronouns and only wish pronouns to show respect be used with me as well. These are called neopronouns, see an example of the word "frog" used as a neopronoun here: http://tinyurl.com/44hhej89 )
A proud member of the Penobscot Native American tribe, as well as a Mayflower passenger descendant. I sometimes post about my genealogical history.
My stance on various issues:
Education: Free to PhD, tax paid
Abortion: Protected, tax paid, limited time-frame
Welfare: Yes, no one should starve
UBI: No, use welfare
Racism: is real
Guns: Shall not be infringed
LGBT+/minorities: Support
Pronouns: Will respect
Trump: Moron, evil
Biden: Senile, racist
Police: ACAB
Drugs: Fully legal, no prescriptions needed
GPG/PGP Fingerprint: 8B23 64CD 2403 6DCB 7531 01D0 052D DA8E 0506 CBCE