/ot/ /np/ /cr/ /st/ /mu/ /fb/ search home


/st/ - STEM


Catalog New


Hi, friends. Let's have a thread for share our personal projects and get reviews.

> URL
> Language / Framework
> Description

 9 posts and 2 files omitted.


>>10
jesus christ anon, you can do function defines inside of classes why the fuck is it a named lambda????
also it wouldn't work. every member of the dataclass must be serializable otherwise the code will crash trying to dump it to json.

>>11
>why the fuck is it a named lambda
Brevity. But yeah, it's ugly. If I could, I'd write it like this
alive: self.max_hunger > self.hunger
...
...
data.alive

>every member of the dataclass must be serializable otherwise the code will crash trying to dump it to json
You can omit the alive member from the json and it will work.
#!./chanogachi.py
{
  "hunger_speed": 0.18333333333333332,
  "max_hunger": 25,
  "hunger": 7.794536099999998,
  "last_interaction": 1709928440.36794
}

>>12
I tried this and I was amazed it actually worked. I would've assumed that dataclass would've interpreted it as an argument with a callable type and a default value instead of being a class member.
The downside to your golf is, if the chanogachi is dead, every time you run the code it will add more hunger forever.
it's simple to fix though, just check if it's alive before doing anything.

by the recommendation of some anons on lainchan IRC I'm thinking about re-writing it in smalltalk so that it's an image-based program.
Or figure out how to make python image-based (dear god forgive me for even thinking about this)


>>13
If you want a mind-bender, you could try writing it in Red. It's a very odd, esoteric language.

https://red.github.io/
http://redprogramming.com/Getting%20Started.html
https://www.red-by-example.org/

Post edited on 9 Mar 2024, 7:22am

>>14
this only works for 32bit systems and right now Debian is in the middle of a time64 transition, so the i386 arch repositories are going to abandoned soon in favor of the new i686 arch, which provides 64 bit time_t.
It won't impact my ability to use it right now, but I hope this project doesn't go kaput in 2038 when time_t rolls over, or goes kaput trying to make it compile on i686.
Will still give it a look like everything else, thanks!

Subject
Message
File
Password (for post editing)
Captcha Fill in the blank - _____☆Star
Submit

Delete Post: [File Only]