i realized random writes may be as simple as applying the same
algorithm to the left and right edges of each unwritten region. this
means implementing region bounds. i got as far as below before
overwhelming dyskinesia.
https://github.com/xloem/flat_tree
append_indices.py
# indexes a balanced tr
https://github.com/xloem/log/blob/wip/multicapture.py#L14L29
# indexes a balanced tree of past indices
class append_indices(list):
def __init__(self, degree = 2, initial_indices = []):
super().__init__(*initial_indices)
self.degree = degree
self.leaf_count = 0
def a
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0, bounds):
- Hide quoted text -
self.x = x
self.y = y
self.t = duration
self.xv = xv
self.yv = yv
def update(self, time):
self.x += self.xv * time
self.y += self.yv * time
self.t -= duration
ret
simulate to test.
p_y(t) = 0 + vy * t - g t^2 / 2
p_x(t) = 0 + vx * t
t_f = vy / g
v_x = p_x(t_f) / t_f = p_x(t_f) * g / vy
-
parabola solving.
p_y(t) = 0 + vy * t - g t^2 / 2
p_x(t) = 0 + vx * t
quadratic equation for p_y(t_f) = 0.
ax^2 + bx + c
a = -g
b = vy
(t_0, t_f) = [-b +- sqrt(b^2 - 4ac)] / 2a
(t_0, t_f) = [-vy +- sqrt(vy^2)] / -2g
t_f = (-vy - vy) / -2g
t_f = vy / g
-
parabola solving.
p_y(t) = 0 + vy * t - g t^2 / 2
p_x(t) = 0 + vx * t
quadratic equation for p_y(t_f) = 0.
ax^2 + bx + c
a = -g
b = vy
(t_0, t_f) = [-b +- sqrt(b^2 - 4ac)] / 2a
-
parabola solving.
p_y(t) = 0 + v_y(0) * t - g t^2 / 2
p_x(t) = 0 + v_x(0) * t
-> first find t_f, when p_y = 0 again
-> then find v_x(0) in terms of t_f
maybe !
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + v_y(0) * t + a_y(t) t^2 / 2
p_x(t) = p_x(0) + v_x(0) * t + a_x(t) t^2 / 2
p_y(t) = 0 + v_y(0) * t - g t^2 /
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + v_y(0) * t + a_y(t) t^2 / 2
p_x(t) = p_x(0) + v_x(0) * t + a_x(t) t^2 / 2
i considered the lines a bit by i
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + integral(v_y(t),t,0,t)
p_x(t) = p_x(0) + integral(v_x(t),t,0,t)
integral(v_y(t),t,0,t) =
integral(v_0y + a_
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + integral(v_y(t),t,0,t)
p_x(t) = p_x(0) + integral(v_x(t),t,0,t)
integral(v_y(t),t,0,t) =
integral(v_0y + a_
integral of xt dt
might make whole problem much simpler
integration increases power
and reduces coefficient
integral(xt,t) = 1/2 xt^2
integral of xt dt
might make whole problem much simpler
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + integral(v_y(t),t,0,t)
p_x(t) = p_x(0) + integral(v_x(t),t,0,t)
integral(v_y(t),t,0,t) =
integral(v_0y + a_
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
p_y(t) = p_y(0) + integral(v_y(t),t,0,t)
p_x(t) = p_x(0) + integral(v_x(t),t,0,t)
-
parabola solving.
p(0) = x0,y0 = (0,0)
a(t) = 0,-g
v(0) = v0_x,v0_y
v(t) = v(0) + a(t) * t
v(t)_x = v0_x + a_x * t
v(t)_y = v0_y + a_y * t
-
parabola solving.
p0 = x0,y0 = (0,0)
a = 0,g
v0 = v_x,v0_y
v = v0 + a
v_x = v0_x + a_x
v_y = v0_y + a_y
v(t) = v
-
parabola solving.
p0 = x0,y0 = (0,0)
a = 0,g
v0 = v_x,v0_y
-
parabola solving.
p0 = x0,y0 = (0,0)
a0 = 0,g
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0, bounds):
self.x = x
self.y = y
self.t = duration
self.xv = xv
self.yv = yv
def update(self, time):
self.x += self.xv * time
self.y += self.yv * time
self.t -= duration
return self.t >= 0
clas
This is the 'triangle' thread. For some reason a new thread happened in my UI.
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0):
self.x = x
self.y = y
self.t = duration
self.xv = xv
self.yv = yv
def update(self, time):
self.x += self.xv * time
self
--
structure generator that reuses spots
def StructureGenerator
def __init__(self):
self.generated = []
def update(self, time):
num_generated = 0
num_to_generate = 1
for idx, structure in enumerate(self.generated):
if structure is None or not structure
--
structure generator
def StructureGenerator
def __init__(self):
self.generated = []
def update(self, time):
self.generated.append(self.new_structure())
for structure in self.generated:
structure.update(time)
def new_structure(self): # override
retu
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0):
self.x = x
self.y = y
self.t = duration
self.xv = xv
self.yv = yv
def update(self, time):
self.x += self.xv * time
self.y += self.yv * time
self.t -= duration
return self.t >= 0
class Partic
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0):
self.x = x
self.y = y
self.t = duration
self.xv = xv
self.yv = yv
def update(self, time):
self.x += self.xv * time
self.y += self.yv * time
self.t -= duration
return self.t >= 0
class Partic
particle systems are something i am still trying to do again, to make
use of structures and graphics.
text mode particle system draft, python
i'll use a normal structure, even though they are slow in python.
class Particle:
def __init__(self, x, y, duration, xv = 0, yv = 0):
self.x = x
s
by nice to slightly change to not use eval() and repr() so it is easy
to rewrite in other languages. can be the thing for now though. may
find it here again!
# 1. load from data storage
class ConsistentContext:
def __init__(self, filename):
self.filename = filename
self._load()
def _load(self):
try:
with open(self.filename, 'rt') as file:
self.data = [eval(line) for line in file]
except:
print(f'making {self.filen
# 1. load from data storage
class ConsistentContext:
def __init__(self, filename):
self.filename = filename
self._load()
def _load(self):
try:
with open(self.filename, 'rt') as file:
self.data = [eval(line) for line in file]
except:
print(f'making {self.filen
Something consistent. That doesn't go all weird.
So that means using data storage to retain information consistently.
ok let's assume the context. basically, the set of stuff that's
considered, is the context.
say we're in the context of integers. now our items are integers.
class Item(int):
pass
and equality is the equal operator
def Equals(a, b):
return a == b
Is this too defined? Not abstracted enough?
i flubbed, "reference" is basically a synonym for "node"
class Reference:
def __init__(self,
class SimpleLogicalThing:
# let's express truth that the number one is one
# 1 is a concept that is convertible to an integer
# equality refers to parts of a concept that are held with shared
value in a context
# so, maybe we'll need: concepts, integer
^
/ \
/___\
>
.
/_\
basically, when you find a match, you'd start search for further matches
that occur strictly after existing matches.
i guess it makes sense to let it find all the matches first, then to look
for further matches that occur after them. and basically to repeat this for
further parts.
i guess a template is a sequence of constant strings separated by varying
lengths of non-matching data
increases the brute-force space to consider varying lengths. likely there
are regions of that space that are far more interesting than others.
basically, you'd look for two-sequence templates, t
thinking on finding repeated occurrences of things, and identifying things
that are one character off.
then also thinking of finding repeated templates, and identifying things
that are one character off.
a repeated template handles more scenarios.
std::string_view is also common with 16*5 or 16^2*5; std::string even more
with 11*7 or 11^1 *7
white space looks interesting
maybe thinking about small code that fixes whitespace
len:1 str: ct:311
len:2 str: ct:135
len:3 str:ct:104
len:4 str: ct:82
len:5 str: ct:60
len:6 str: ct:46
len:7 str:ct:32
len:8 str: ct:23
len:9 str: ct:14
len:10 str: ct:9
len:11 str:std::string ct:7
len:12 str:std::string_ ct:5
len:13 str:std
#include
#include
#include
#include
#include
using strint_it = std::unordered_map::iterator;
std::string_view find_most_useful_string(std::string const & doc)
{
// measure all strings in doc in a naive way, finding the one with the
most repetitions.
// stop when repetitions * length^2 d
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height / 2)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row) {
int bgratio = (end_offset - start_
*[user@DESKTOP-E3P7TC0 scratch]$
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
class grid:
def __init__(self, width = 7, height = 4):
self.spots = [bytearray(width) for x in range(height)]
canvas = grid(7, 4)
canvas.spots[0][3] = 1
canvas.spots[1][2] = 1; canvas.spots[1][4] = 1
canvas.spots[2][1] = 1; canvas.spots[2][5] = 1
(canvas.spots[3][x] = 1 for x in range(7))
grid = twenty_zeros()
grid.zeros[0][3] = 1
grid.zeros[1][2] = 1; grid.zeros[1][4] = 1
grid.zeros[2][1] = 1; grid.zeros[2][5] = 1
(grid.zeros[3][x] = 1 for x in range(7))
turns out it's 28, not twenty.
class twenty_zeros:
def __init__(self):
self.zeros = [bytearray(7) for x in range(4)]
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 1 0 1 0 0
0 1 0 0 0 1 0
1 1 1 1 1 1 1
#include
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
[thread:personal]
EXPLANATION OF THIS THREAD
I struggle cognitively sometimes, where I can barely hold thoughts I
choose at all.
Triangles and triangle-drawing code is something I've practiced
holding, through many rough psychological experiences, sometimes
through many days.
Because in my teen
zeynep,
I received an email from you that isn't making sense to me.
On 5/25/22, zey...@keemail.me wrote:
> :
>
>>>
>>> > On Tue, 24 May 2022 18:02:14 -0400
>>> > Karl Semich <0xl...@gmail.com> wrote:
>>>
>>>
>>> HEY FUCKING WONDERFUL PERSON, want to learn a programming language with
>>> me?
>>>
thread:[personal]
import operator, time
class TinySuccessfulGoal:
def __init__(self, start_value):
self.value = start_value
def meet_goal(self, value):
print(f"i can totally make {self.value} be {value}!")
while self.value != value:
if self.value + 1 < value:
print(f"Seems small. Maybe
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height / 2)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row) {
int bgratio = (end_offset - start_
#include
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
this is a fun algorithm challenge for confused-beyond-words
using strint_it = std::unordered_map::iterator;
std::string find_most_useful_string(std::string const & doc)
{
// measure all strings in doc in a naive way, finding the one with
the most repetitions.
// stop when repetitions * length
#include
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
std::string find_most_useful_string(std::string const & doc)
{
// measure all strings in doc in a naive way, finding the one with
the most repetitions.
// stop when repetitions * length^2 decreases
std::unordered_map counts;
int length = 1;
todo todo syntax error
}
std::string find_most_useful_string(std::string const & doc)
{
// measure all strings in doc in a naive way, finding the one with
the most repetitions.
// stop when repetitions * length^2 decreases
}
we could use the utility to find a really heavy string!
what's is the most common character?
then, what is the most common 2-character string?
i'll try it!
just looking to improve my coding, here
it seems like useful templates might be full of heuristics of utility.
how many characters important, how far away. to generate templates.
one could measure that utility, try to consolidate the heuristic, into
something like repetitions * constant character count.
this seems like a fun puzzle because it's really hard. thinking of
something small enough to hold in this state of mind, that could help
code. really small.
one idea is, maybe fix bugs by matching templates. could that be made small?
like if i made a typo, lots of print() and one print(], wrong c
code has control flow constructs and functions
and these are made of templates.
templates are powerful.
the goal is to draw a triangle.
maybe something really small that could write part of code
a very small part
hmm
.
/_\
maybe it's okay!
i think i read a little part of ai book when i was like 8 or 17
something. there are a lot of heuristics that do things on their own
but aren't smart unless you really use them like crazy.
imagining this:
- try steps out until metric gets close
- repeat so long as getting closer
maybe it would be helpful for it to select steps.
i'm a little worried around it. it's easy to implement something that
would fail at an unexpected task.
maybe that's okay.
What a successful goal process! It met one goal, after a little work!
I'm noticing two really core points around goals:
- need to select steps that help get closer
- need to repeatedly do them until goal is met
i can totally make 3 be 7!
Seems small. Maybe making it bigger?
I'm at 4!
Seems small. Maybe making it bigger?
I'm at 5!
Seems small. Maybe making it bigger?
I'm at 6!
This seems really close. Maybe just a nudge!
I'm at 7!
I met the goal!
# i ended up repasting from html mode
import operator, time
class TinySuccessfulGoal:
def __init__(self, start_value):
self.value = start_value
def meet_goal(self, value):
print(f"i can totally make {self.value} be {value}!")
while self.value != value:
if self.value + 1 < va
left out {}
sed "s/[^0-9a-zA-Z\"' \-\+\(\)=_:]//g"
>
when i paste it python complains it's full of nonprintable characters.
never fear!
sed "s/[^0-9a-z\"' ]//g'
>
i meant to add a delay, so that the user or programmer could experience the
process developing
import operator, time
class TinySuccessfulGoal:
def __init__(self, start_value):
self.value = start_value
def meet_goal(self, value):
print(f"i can totally make {self.value} be {value}!")
import operator, time
class TinySuccessfulGoal:
def __init__(self, start_value):
self.value = start_value
def meet_goal(self, value):
print(f"i can totally make {self.value} be {value}!")
while self.value != value:
if self.value + 1 < value:
print(f"Seems small. Maybe
since it's all about doing things
i guess it makes a little sense to try to make a goal program.
it's hard to hold goals.
how to meet a goal: select steps that produce a state where it is present,
and pursue them.
how can we simplify to very simple and small?
say we had a number, a variable, a
**
* *
**
* *
**
* *
**
**
* *
**
* *
**
* *
**
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height / 2)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row) {
int bgratio = (end_offset - start_
> cout << ' *' << endl;
i had to remove the typo space here
**
* *
**
* *
**
* *
**
* *
better add a bottom.
i think i'm familiar with it being hollow
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height / 2)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row)
**
**
**
**
**
**
**
**
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row) {
int bgratio = (end_offset - start_offs
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height)
{ }
void draw()
{
int start_offset = width / 2;
int end_offset = 0;
for (int row = 0; row < height; ++ row) {
int bgratio = (end_offset - start_offs
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height)
{ }
void draw()
{
for (int row = 0; row < height; ++ row) {
todo todo syntax error
cout << endl;
}
}
private:
int width, height;
void line
#include
using namespace std;
class Triangle
{
public:
Triangle(int width, int height)
: width(width), height(height)
{ }
void draw()
{
todo todo syntax error
}
private:
int width, height;
}
int main()
{
Triangle triangle;
triangle.draw();
}
#include
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
simple thing
does simple part
not sure.
maybe make triangle more useful?
oh! it is useful! it moves toward visualization. charts.
came up with new idea of triangle but don't remember what is
triangle
http://caca.zoy.org/wiki/libcaca is licensed under the Do What The Fuck You
Want To Public License
https://github.com/xloem/SDL.git branch caca
commit 116795b3f413f39e396a3a6d4bc5f82225b13e52 (HEAD -> caca, origin/caca)
Author: xloem <0xl...@gmail.com>
Date: Sun May 15 13:31:36 2022 -0400
cacavideo.h from rpivideo.h
src/video/caca/SDL_cacavideo.h | 103 +++
1 fi
#include
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
#include
#include
int main()
{
// one way to enable mouse tracking
printf("\e[?1000h\e[?1006h");
// disable echo and line buffering for mouse
struct termios term;
tcgetattr(0, &term);
int user_lflag = term.c_lflag;
term.c_lflag &= ~(ECHO | ICANON);
tcsetattr(0, TCSANOW, &term);
#include
#include
int main()
{
// one way to enable mouse tracking
printf("\e[?1000h\e[?1006h");
// disable echo and line buffering for mouse
struct termios term;
tcgetattr(0, &term);
term.c_lflag &= ~(ECHO | ICANON);
tcsetattr(0, TCSANOW, &term);
// read next mouse location
#include
#include
int main()
{
printf("\e[?1000h\e[?1006h");
struct termios term;
tcgetattr(0, &term);
term.c_lflag &= ~(ECHO | ICANON);
tcsetattr(0, TCSANOW, &term);
int x,y;
scanf("\e[<0;%d;%dM", &x, &y);
printf("\e[?1000l");
printf("%d %d\n", x, y);
term.c_lflag |= EC
#include
On Sun, May 15, 2022, 12:26 PM Undiscussed Horrific Abuse, One Victim of
Many wrote:
>
>
> On Sun, May 15, 2022, 12:23 PM Undiscussed Horrific Abuse, One Victim of
> Many wrote:
>
>> https://stackoverflow.com/a/5970472/129550
>> mouse reporting/tracking
>> "\e[?1000h"
>
>
int main()
On Sun, May 15, 2022, 12:23 PM Undiscussed Horrific Abuse, One Victim of
Many wrote:
> https://stackoverflow.com/a/5970472/129550
> mouse reporting/tracking
> "\e[?1000h"
"\e[?1006h"
stdin
1b 5b 3c 30 3b 33 38 3b 33 33 4d 1b 5b 3c 30 3b
|.[<0;38;33M.[<0;|
0010 33 38 3b 33 33 6
https://stackoverflow.com/a/5970472/129550
mouse reporting/tracking "\e[?1000h"
1 - 100 of 115 matches
Mail list logo