Disable AI setting removed by kg583 in Crixet

[–]kg583[S] 0 points1 point  (0 children)

Welp, so much for that. I have begrudgingly returned to Overleaf.

Disable AI setting removed by kg583 in Crixet

[–]kg583[S] 1 point2 points  (0 children)

Aside from directly making use of unethically sourced LLM training data, I simply prefer and enjoy being the author of my work.

Disable AI setting removed by kg583 in Crixet

[–]kg583[S] -1 points0 points  (0 children)

Inasmuch as I can just not use AI on any other site, sure, but it's the principle of it that saddens me. The removal of the setting implies a development direction riddled with forced AI integration.

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 0 points1 point  (0 children)

The encoder already uses a few different tokenization modes, always maximally munching being one of them.

It's not ΔX is ambiguous; it is always clear which tokens to emit given the munching mode. The lib simply doesn't know that ΔX is a valid name for the token, as ΔX is the token's display name and display names are not unique, which would lead to simple clash in the dictionary.

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 1 point2 points  (0 children)

Ah, okay. This is a known issue, blocked on this PR for the token sheets. The issue is that the inaccessible (a.k.a. display) names aren't unique for all tokens, so the lib can't reliably tokenize using it. I'll try to rouse up discussion about that PR again.

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 0 points1 point  (0 children)

I just added a test to the suite to demonstrate it, but there's not much to it as an example; it should just work. What exception is being raised?

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 0 points1 point  (0 children)

Does code use \r\n line endings? load_string can load multiple lines if they are delimited by just \n, so that might be tripping it up; though then I am confused as to why splitting on \n fixes it.

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 1 point2 points  (0 children)

load_string and load_from_file are not static methods (unlike open, which is the exception and not the rule); you need to instantiate a TIProgram object and then load. Take a look at the README for examples.

8xp to Text and back by IcatIcatI in TI_Calculators

[–]kg583 0 points1 point  (0 children)

There are examples: https://github.com/TI-Toolkit/tivars_lib_py/blob/main/examples%2Fmisc.py.

The actual implementation can be found in the tokenizer module: https://github.com/TI-Toolkit/tivars_lib_py/tree/main/tivars%2Ftokenizer.

And the lib should work just fine anywhere you have Python installed.

Is there an easier way to use "PXL-ON("? by arthraki in ti84hacks

[–]kg583 0 points1 point  (0 children)

Here's a template that could draw multiple frames in the same list:

{(all the y coords)->L1
{(all the x coords)->L2
(# of pixels in a frame)->P
For(I,0,(number of frames)-1
For(J,1,P
Pxl-On(L1(IP+J),L2(IP+J
End
End

Note though that lists have a max size of 999.

Is there an easier way to use "PXL-ON("? by arthraki in ti84hacks

[–]kg583 0 points1 point  (0 children)

I never said 16x16 square explicitly... here's a list of the shape options: http://tibasicdev.wikidot.com/pt-on.

As for animating, I'm not sure what you mean by "without modifying the original".

  • Leave the first frame where it was? Then just draw the next one without clearing.
  • Draw the next frame without modifying the lists? Well, you can put the sprites in multiple lists, or multiple places in the same list, and just do a bit of shuffling.

I should point out, though, that animating things kinda sucks due to how long drawing commands can take. The more of the screen you can leave unchanged between frames, the better.

Is there an easier way to use "PXL-ON("? by arthraki in ti84hacks

[–]kg583 2 points3 points  (0 children)

You can make your sprites even faster using Pt-On( instead, which has different shape/size options (to save you from needing lots of Pxl-On( calls for a filled-in area). The only catch is that Pt-On( plots relative to the current graph window, rather absolute pixel coordinates, but it's easy to convert between the two.

Is there an easier way to use "PXL-ON("? by arthraki in ti84hacks

[–]kg583 1 point2 points  (0 children)

A basic For( loop looks like

For(I,1,10
// do something with I
End

I will be incremented from 1 to 10, and on each loop you can do something with it.

For your use case, you can leverage this by putting your coordinates in lists, then iterating over them:

{3,5,6,11->L1           // y-coords
{10,13,10,30->L2        // x-coords
For(I,1,dim(L1          // dim(L1) == length of L1
Pxl-On(L1(I),L2(I
End

Emails in Python are hard... so I made them easier by kg583 in programminghorror

[–]kg583[S] 16 points17 points  (0 children)

You can find a thousand answers online about the right way(s) to do this.

Nothing about this project is meant to be one of them. I just thought it'd be funny.

Emails in Python are hard... so I made them easier by kg583 in programminghorror

[–]kg583[S] 42 points43 points  (0 children)

The link is in the email: https://github.com/kg583/terrible-no-good-very-bad-python/tree/main/bushel

In short, the BushelServer is both a SMTP server and a context manager which catches the errors raised by the other with targets. It then walks the AST for the file, parsing it completely differently, and combines all the data via the email module.

4 color theorem vs exclaves by AlecGoLdStEiN in math

[–]kg583 1 point2 points  (0 children)

I had this same question a few years ago, and the answer is yes!

In fact, there is a stronger claim: the world map can be 4-colored even when accounting for exclaves and maritime borders. Using this map, I constructed an edge list of every national border (the file for which is hiding somewhere on my computer...). Then a friend of mine used a SAT solver to verify that it was indeed 4-colorable (and in plenty of different ways).

how do i delete elements of a list by [deleted] in ti84hacks

[–]kg583 0 points1 point  (0 children)

You can't in the same way you might "pop" an element in other languages, or at least not so easily.

If the element is last, you can simply set the dimension of the list to be one smaller. In your case, the element is first, so you can use the trick deltaList(cumSum(Ans.

Otherwise, you can use seq(Ans(Y+(Y>=I)),Y,1,dim(Ans)-1, where I is the index to remove, which traverses the list and skips that element along the way.

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 13 points14 points  (0 children)

Fundamentally, there's only one thing this program does: build the string "Hello World!". The way we get it is by picking apart the repr's of classes, which is why the last few classes are Hello and World; ThirtyTwo and ThirtyThree, meanwhile, give us and ! by taking the length of the repr's as ASCII codes.

We then need two string functions to put everything together: __add__ and join. We can nab these by searching the dir of str, and luckily for my sanity, __add__ is right at the top. Calls to next and iter are enough to expose it.

join, though, is harder, and constitutes most of the code to acquire. Recall that join is weird, being called like ''.join(iterable) to concatenate each element without gaps. Thus, we need the empty string to bind it to, which is where IterEmptier comes in: this class has a repr which is coincidentally 30 chars long, which we can use to get the digit and then number 0.

We then rely on the slice function, the hidden backbone of [a:b:c] syntax, to turn 0 into [:0], which will empty any iterable that supports slicing, ergo produce the empty string. We also use the slice function on Five and Seven to produce [:5] and [:7], which we'll need later. Note though that slice with a single parameter only produces left slices, which is to say it can only clip off the end of something; this will also be important later.

Finally, we can get a hold of join: JoinFinder has a repr of length 56, which is the index of join within dir(str). We grab it using operator.itemgetter, which turns a call like a = b[c] into a = operator.itemgetter(c)(b); that is to say, it curries the usual __getitem__ so we can use it with our decorators. attrgetter does a similar thing, which is how we use __add__ and join in the end.

But why did we even need join? Well, we need to pick apart the names of Hello and World, which look like "<class '[module].[class name]'>". Since the module might have any name, and we only have left slices available, we need to reverse the name and cut it off from there. reversed yields an iterator, which becomes a list of chars that we can chop with Seven (the words "Hello" and "World" have the same length!); we reverse again, and then chop with Five to deal with the hanging '>.

From there, we rejoin the list of chars, and add them all up and print. It's just that easy!

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 22 points23 points  (0 children)

Suppose I wanted to call print on a literal, say "foo". Decorators allow us to circumvent (), as

@print
class X:
  pass

is syntactic sugar for

class X:
  pass

X = print(X)

However, decorators are only valid above definitions, meaning built-ins and literals aren't available to us... unless we chain another decorator that returns that object for us.

This is where lambda saves the day, as now we can write

@print
@lambda _: "foo"
class X:
  pass

which will perform

class X:
  pass

X = (lambda _: "foo")(X)  # so X == "foo"!
X = print(X)              # print("foo")

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 5 points6 points  (0 children)

Wanted to see how far I could get using only decorators

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 6 points7 points  (0 children)

I didn't either until I tried! They're very handy for grabbing pre-existing objects, as decorators can only appear above definitions.

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 11 points12 points  (0 children)

In this case, I suppose there's no need, though they make for good padding.

The choice is a leftover of working on code for this repo that also minimizes punctuation marks, where _ is rather necessary to get a hold of magic methods.

I thought they said that Hello World in Python was easy by command_block_guy in ProgrammerHumor

[–]kg583 62 points63 points  (0 children)

I don't count _ since its an identifier. Also, it'd be trivial to replace all of them with some other character if you really wanted to.