#programming

1 messages · Page 223 of 1

real sierra
#

HOLY actually released his own source code?

#

wdym not using the API Awkward

stray dragon
#

not using the api or macros, released source code, reduced tokens by huge amount already??

#

this dude is so real

fierce ether
stray dragon
#

holy shit

rigid timber
#

damn, bro playing on hard mode

stray dragon
fierce ether
#

rnbqkbnrpppppppp................................PPPPPPPPRNBQKBNR

#

my goat

real sierra
#

who's gonna tell bro I'm compiling with -std=c23

fierce ether
#

wdum

stray dragon
clear sedge
#

no implicit int

stray dragon
#

no having i; as a declaration of i

clear sedge
stray dragon
#

needs to be int i;

#

also for functions, and for function inputs

#

also: variable names can be as long as you want

#

they'll still count as 1 token

#

long numbers also count as 1 token

fierce ether
amber fractal
#

On the positive note, macros are going to have a field day existing with #define ONE 1, #define ZERO 0, #define TWO 2,

trim valve
rigid timber
#

someone also tell Smeagle that it's about token count, not character count...

stray dragon
# stray dragon

error: type of "minimax" not declared
error: type of "d" not declared
error: type of "a" not declared
error: type of "b" not declared
error: type of "m" not declared

rigid timber
#

you don't need to have single-variable names without any spaces anywhere icant

stray dragon
#

no implicit typing

#

you have to explicitly tell it what type each variable is

clear sedge
#

or use auto if you're a pussy

stray dragon
#

not a thing in C i think

#

only in C++

amber fractal
real sierra
#

auto's face when I #define PBoard Board *

clear sedge
stray dragon
#

oh fr?

real sierra
clear sedge
#

yes

stray dragon
#

hmmm.

real sierra
#

auto already existed in C but with a different and useless meaning

trim valve
real sierra
#

they extended it to have the C++ meaning as well

stray dragon
#

this could save me like 2 tokens

real sierra
#

anyway I think smeagle should be ok still, they just might have to gain a few tokens

clear sedge
#

afaik auto was always implicitly there with the original storage class meaning Stare_Lizord

trim valve
#

glueless guys I'm goated

real sierra
#

gotta add those types

clear sedge
#

i love when i auto auto

#

name so nice you say it twice

real sierra
amber fractal
trim valve
#

its probably a lot more golfable in C

real sierra
#

and then you use macros coding

stray dragon
real sierra
#

that's also true but if you're really committed to not doing so

#

though I have to admit, I'm not sure how your current code gets the board from the chess host

stray dragon
#

calculating legal moves without the api is not that fun

amber fractal
#

Wait, I don't need to install the C toolchain to test the token count

stray dragon
#

would expect it to cost like 500 tokens minimum

#

accounting for the complexity added by en passant and castling

amber fractal
#

Laptop get over here I'm writing sudocode

real sierra
#

if they want to challenge themselves then that'd be really cool

stray dragon
#

^

fierce ether
real sierra
#

a minimal legal moves implementation is no joke

trim valve
obsidian mantle
#

will gcc handle this

#

vscode is scared

stray dragon
real sierra
#

oh I see

#

I would just make the bool an int

trim valve
#

I'm still more than mildly tempted to force something to assume I have popcnt so I get a mild board evaluation speed boost

clear sedge
real sierra
#

should work the same and the warning will probably go away

obsidian mantle
#

im calling is_white and passing it to chess_get_bitboard

real sierra
#

oh, yeah that's probably fine

clear sedge
#

i mean it'll compile and probably work

obsidian mantle
#

i'll try to compile lets see what g++ says

clear sedge
#

it'll probably give you a warning

trim valve
clear sedge
#

you're safe to ignore it though

real sierra
#

warnings are good

trim valve
#

but glueless

real sierra
#

warnings are a sign you're being token efficient

rigid timber
trim valve
#

genius

obsidian mantle
#

it shows it as error

#

vscode

#

oops

clear sedge
real sierra
#

then have to cast

obsidian mantle
#

is this a cast

rigid timber
# trim valve genius

tbh I'm pretty sure Shiro's CPU supports SSE4, Rust is just very conservative with the defaults

real sierra
#

should be

clear sedge
#

that is a cast yes

real sierra
#

if that fails then there's always chess_is_white_turn(board) ? WHITE : BLACK

obsidian mantle
real sierra
#

which will work for sure

obsidian mantle
#

cant cast piecetype

real sierra
#

6

obsidian mantle
#

king

clear sedge
#

just use the enum value

real sierra
#

can you just do KING instead

clear sedge
#

it's the same amount of tokens either way unless it's an enum class

obsidian mantle
#

i thought i need to do something like piecetype.king

#

alright then

real sierra
#

in C, just KING should work

#

obsidian mantle
#

works here too looks like. alright

clear sedge
#

c++ has the same behavior for non-class enums

#

:3

real sierra
#

C++ eww

obsidian mantle
#

do i need to make a function to convert piecetype to bool neuroBwaa

stray dragon
#

stupid ass enums smh

obsidian mantle
#

what if i pointer cast it

real sierra
#

this is probably easiest

clear sedge
#

* (T *) &t is probably more tokens than ternary

obsidian mantle
#

yeah fine

#

worked i think

stray dragon
#

does something like !!chess_is_white_turn(board) work?

clear sedge
#

it's still a bool tho

real sierra
stray dragon
#

ah i see

real sierra
#

idk why the conversion is being so upset

stray dragon
#

so your function sucks

#

thanks shiro

rigid timber
real sierra
#

how can C not convert bool to enum

clear sedge
#

it's c++

obsidian mantle
#

what scenario could cause problems

#

in this kind of conversion

real sierra
amber fractal
#

@trim valve Whitespace is not counted

#

Now for the lols let me justttt

clear sedge
#

idk why this is slightly funny to me

stray dragon
#

it's free real estate

fierce ether
#

see this is why you release source code

#

thank yall

stray dragon
real sierra
#

im too scared to release my source code in case someone improves it more than I do

trim valve
#

glueless I know that if I release my code I will be safe because anyone who codes better than me will be writing C anyways and despise rusts syntax

stray dragon
#

i'm not sharing mine because it was all written before the tournament rules and the silly little -std=c23 was there (also it's never been tested) ((also also it's probably dogshit))

#

just gonna do a full rewrite i think

#

maybe carry over the neural net and eval function

#

and then redo the search method

amber fractal
stray dragon
#

how many -1's do you HAVE

amber fractal
#

On the other hand... I only did line 4

real sierra
#

is -1 actually two tokens

stray dragon
#

yes

#

it is

amber fractal
#

Yep

real sierra
#

why...

nocturne olive
#

Unfortunately no macros in Kotlin

stray dragon
#

i just have a #define n1 -1 lol

stray dragon
real sierra
#

I would just find the unsigned int equivalent

obsidian mantle
#

0b11111111111111111111

stray dragon
#

competitive enough on its own

real sierra
#

and use that

nocturne olive
quick sun
#

I may be stupid but what is a token (I'm a python dude)

stray dragon
real sierra
quick sun
stray dragon
real sierra
#
int myVar = 1; --> ["int", "myVar", "=", "1", ";"]
stray dragon
#

in this case, a token is whatever the toknt thing says it is

rigid timber
nocturne olive
#

One example of Kotlin STD being insane here in my patched in anti-stalemate

stray dragon
#

string of 8 billion characters? yeah that's 1 token

clear sedge
stray dragon
#

1 single comma? yeah that's also 1 token

amber fractal
#

For the lols, defines for 0, 1, -1, 2, decrease line 4 from 199 tokens to 167

real sierra
#

why define 0

nocturne olive
stray dragon
#

it's 0,

#

not 0

quick sun
#

I just realised I'm a chess player and a programmer and have no idea what I'm doing still. this'll be fun

real sierra
#

smart

rigid timber
#

I still haven't started any work on my bot icant

clear sedge
#

dw neither have i

nocturne olive
rigid timber
#

I do have most of the JS bindings done tho...

obsidian mantle
#

it worked neuroHypers
first actual mate

stray dragon
#

i'm a comma HATER so i personally do this because i'm deranged

clear sedge
#

js bindings Aware

quick sun
rigid timber
#

(I haven't actually tested them yet)

stray dragon
#

ah wait i need spaces

obsidian mantle
quick sun
#

ahhh

#

that makes sense

nocturne olive
obsidian mantle
#

maybe its luck i'll check more

real sierra
clear sedge
stray dragon
#

perfect

rigid timber
#

tbh the larger issue will be properly representing a Move without copying it twice...

clear sedge
# stray dragon

you can just merge them all into one string constant to save even more tokens

real sierra
#

did t see the 64-bit token rule

stray dragon
#

i did

#

that's why they're all 64 bits

real sierra
#

then you're fine OK

stray dragon
#

each string is up to 1 long long

#

and no more

real sierra
#

totally valid for the use case if those are storing what I think they are

clear sedge
#

1 long long long?

stray dragon
#

long long long long long

rigid timber
#

loooooong loooooooong maaaaaaaaaaaaaaan

real sierra
clear sedge
#

how long is a long long int if a long long could long long int

nocturne olive
#

Just cleaner

rigid timber
#

I don't like it mahiro

clear sedge
nocturne olive
stray dragon
#

i must feed it many hex codes

rigid timber
#

but I think I'll just do a copy first and see if it actually affects performance

stray dragon
#

before i had them all hidden away in a single massive string of parameters lol

#

then i saw that annoying rule

#

truly unfortunate

#

i wonder if i can find a way to compress them later.

amber fractal
stray dragon
#

damn it iggly

rigid timber
#

so what actually are those long longs?

stray dragon
#

i could have had INFINITE parameters for my neural net

rigid timber
#

ah

stray dragon
amber fractal
clear sedge
#

imagine making the chess bot with a backdoor where you can control what it does directly

rigid timber
#

Hmm question for the C nerds, is Move 24 bytes?

clear sedge
#

cheating? most definitely
funny? most definitely

rigid timber
#

the Move struct

trim valve
#

I know rust does

clear sedge
#

just print sizeof(Move)

rigid timber
clear sedge
#

oh

#

my condolences

nocturne olive
rigid timber
#

that's 22 bytes, which doesn't exactly align to anything

clear sedge
#

i mean depending on compiler & options it may also align to like 16 bits in which case it'd be 32 bytes

trim valve
nocturne olive
#

Oh, no, it's 8 + 8 + 1 + 1 + 1

rigid timber
nocturne olive
obsidian mantle
#

not mating anymore despair
its over

rigid timber
#

well fuck me I guess, bc depending on the compiler not to fuck with the alignment is kinda futile

clear sedge
#

just test the alignment and size in c using the same flags as the readme says it uses

rigid timber
#

I'll just trust what bred got, surely it won't result in anything bad

#

otherwise it's Shiro's fault

real sierra
#

my best bet would be that C packs the bools into one byte with masking but it's probably implementation defined

final tinsel
#

chayleaf idk if ur here rn but ik you live here, so i wanted to tell you that i noticed that you are in the infinite free wil gif

nocturne olive
nocturne olive
clear sedge
#

bool? more like boooooooooo

stray dragon
#

fuck bool

clear sedge
stray dragon
#

imagine using bool

#

lmao

trim valve
#

iirc c++ does some shenanigans with vectors of booleans

sage crag
rigid timber
#

it actually is 24 bytes, at least on Windows with MSVC...

sage crag
#

bitflags

#

they should have just put it in a different type

#

to be honest

#

vector => vector

#

bitflags => bitflags

trim valve
#

no konii

#

you must abide to the thinking of my a level computer science teachers

rough bloom
rigid timber
#

well yeah, but who knows how the compiler would fuck with it

rigid timber
#

trusting a C compiler not to do something stupid is like trusting Shiro not to have a birthday today

stray dragon
#

poor shiro

rough bloom
#

are compilers allowed to mess with structs like that
I thought alignment and such are defined as part of the target, so they should at least be consistent on one platform

sage crag
rigid timber
#

dinkdonk Shiro go specify the struct alignment

sage crag
#

all the c spec guarantees is that members are stored in order and that sizeof(T) includes padding

#

iirc

#

it allows compilers to insert padding or do alignment, but its up to them what they do with it

#

oh also it obviously defines that accessing members with a.b or a->b is safe

rough bloom
#

ye, the specific alignment for each type isn't given by the spec I think, it's given by the target
but surely if the spec guarantees that fields are in order and are aligned then it's consistent as long as the same alignment is used for everything? buh

sage crag
#
struct A {
  uint8_t b;
} __attribute__((aligned(16)));

struct C {
  uint8_t d;
  uint16_t e;
} __attribute__((packed));
sage crag
#

therefore padding bytes may vary and therefore the whole struct size

rough bloom
sage crag
#

its why things like sizeof(Struct) exist rather than just deciding its sizeof(uint8_t) + sizeof(uint16_t)

sage crag
#

especially with the main two gcc and clang

#

though clang's is more up to llvm, and who knows what llvm is doing

rough bloom
#

C is technically platform-agnostic so it doesn't specify anything here, but the actual compilers do

#

-# kinda

sage crag
#

cpu arch + abi + os are for compilers and toolchains

#

c spec is for c

#

actually this is a notable case

#

abi may force different alignment

#

as well as cpu arch

#

os is less common but im sure something of that kind happens too since long means different things on windows and linux

real sierra
#

tldr do not assume anything about the size or alignment of the move struct

rigid timber
#

well that's nice but that doesn't really work

#

if we get a raw pointer and a move count, how are we supposed to pick out moves from the array the pointer points to if we don't know the size of Move

sage crag
#

shiro can add __attribute__((packed))

#

to the def of the struct

#

or shiro could provide a better api for moves

rigid timber
#

y'know what, I'll create an issue for exactly that

real sierra
#

surely your ffi backend has methods for extracting fields from a struct

rigid timber
#

it doesn't, no

real sierra
rigid timber
#

because structs don't have a concrete representation if you don't specify it

real sierra
#

surely you can just specify the field types and the ffi backend can figure out how that translates on your system tho

sage crag
#

__attribute__((packed)) wont really pessimise performance that much, and it would guarantee alignment on most compilers

rigid timber
#

well no, how would it know what it translates to?

nocturne olive
real sierra
#

how does it for every other ffi implementation

sage crag
#

the structs are opaque to ffi

rough bloom
real sierra
#

so adding __attribute__((aligned(N))) and __attribute__((packed)) to Move would fix this?

#

for reasonable N that is

trim valve
sage crag
nocturne olive
trim valve
#

yes but a Boolean does not take up one bit of space in any sane language as much as they tried to convince me they did 😭

sage crag
#

for the platform it is not

trim valve
#

I guess, but that clearly wasn't what either of us were meaning at the time

sage crag
#

bool is typically defined (per-platform) as the minimum addressable size of the platform

sage crag
#

packed is typically equivalent to aligned(1) so im not sure the reason for it existing

rigid timber
#

Hmm if the alignment is larger than some of the fields, the padding is after the actual field value, right?

sage crag
#

aligned() works on bytes and not bits so as per the c spec packed and aligned 1 should be equivalent evilShrug

rigid timber
#

well assuming little endian bc pretty sure nobody here has a big endian CPU

sage crag
#

i dont think they play nicely together

real sierra
#

will do packed

sage crag
#

ideally packed for abi compatibility

real sierra
#

simpler

rigid timber
#

yay

sage crag
#

might pessimise performance a bit but oh well

rigid timber
#

do I still have to create the issue for you to not forget?

sage crag
#

should be negligible

rough bloom
#

unaligned memory accesses RAGEY

real sierra
#

if you make a PR I can approve it soon

rigid timber
real sierra
#

otherwise will take a bit of time

trim valve
#

I love packed

#

I love ub

obsidian mantle
#

a bit

rigid timber
#

packed structs have ub?

sage crag
trim valve
nocturne olive
sage crag
real sierra
#

classic FFI devs telling me the problems are my fault and I should add UB to the API to fix it

sage crag
sage crag
#

rust skill issue

real sierra
#

it joke

trim valve
nocturne olive
#

You better not break my code ```kt
fun getLegalMoves(board: Board): Array<Move> {
val len = IntByReference()
val movesPtr = nativeBindings.chess_get_legal_moves(board.value, len)

    val moves = Array(len.value) { i ->
        val offset = i * MoveByPointer().size()
        MoveByPointer(movesPtr.share(offset.toLong())).toMove()
    }

    nativeBindings.chess_free_moves_array(movesPtr)
    return moves
}
real sierra
#

CatLaughingAtYou rust

rough bloom
sage crag
rigid timber
nocturne olive
#

If you break it you're responsible for fixing it too

sage crag
#

since that's the typical page size

rough bloom
rigid timber
nocturne olive
#

With no breaking changes

sage crag
nocturne olive
sage crag
#

unaligned reads do can pessimise a lot, mostly on older cpus

#

or embedded

nocturne olive
rough bloom
# trim valve I love packed

I love C
it's great that it's become the standard for FFI everywhere, even though there may be no C code involved at all
truly amazing neuroPogHD

rigid timber
nocturne olive
#

Compile flag or something

rigid timber
#

JNA makes the same assumptions I'm making, that it aligns to 4 bytes

rough bloom
nocturne olive
#

I recommend making changes to the API optional and disabled by default unless you can confirm existing bindings work with them fine

sage crag
#

which, really arent a huge issue most of the time on modern cpus

sage crag
nocturne olive
#

Anyway I need to sleep soon-ish probably, so you better not break my code in the meantime

rigid timber
#

too bad

rough bloom
#

mods, break his code

nocturne olive
#

Like really please don't break my code

opaque sigil
#

all code shall be broken

nocturne olive
sage crag
trim valve
#

shiro can you make it so the struct layout is random and you have to infer it every time

nocturne olive
#

I hate dealing with raw memory access as-is so I may not have the motivation to fix memory issues

trim valve
rough bloom
#

-# or rather, the reference compiler does

nocturne olive
#

I just want to build a silly Chess bot in peace and not have to worry about my core API breaking in the middle of it

trim valve
#

idk how badly bindgen would implode

nocturne olive
#

Like if you change the memory alignment AT LEAST make it optional and disabled by default

rigid timber
trim valve
rigid timber
#

that's the one thing that probably won't get broken kek

rough bloom
#

neuroNODDERS would be surprised if bindgen didn't deal with packed structs before

rigid timber
#

I mean, Shiro could "just" add manual padding to actually make it 24 bytes always

#

bc I'd imagine it's 24 bytes everywhere now, just not guaranteed

rough bloom
#

it should be, ye

rigid timber
#

at least it's 24 on Windows

real sierra
nocturne olive
#

Just please don't break my Kotlin bindings and I'll let you do whatever you want, as long as I can just compile a new SO and throw it in as-is

opaque sigil
#

worst case you have to add like 1 line for the struct's alignment

real sierra
#

I'd rather avoid breaking changes to every existing bindings just to support another, but it sounds like not specifying the alignment is a proper issue for cross-platform compatibility

#

so I'm willing to make a change to the C API to specify the alignment

nocturne olive
#

Make it a compile flag PLEASE

real sierra
#

let's put it this way

#

you don't know what alignment my system uses

#

or how my system will align or size this struct

nocturne olive
real sierra
#

without defining the alignment, there is zero guarantee your bindings even work on my system

sage crag
#

i am here to unfortunately announce

#
#define SEED ((__TIME__[6] - '0') * 10 + (__TIME__[7] - '0'))
enum { RAND_VAL = ((unsigned long long)(SEED) * 1103515245ULL + 12345ULL) & 0x7fffffffULL };

typedef struct {
    long x;
    short y;
    unsigned c;
} __attribute__((aligned(1 << (RAND_VAL % 4)))) Erm;

this works

rigid timber
opaque sigil
trim valve
rigid timber
#

Shiro can you ban that person, they're commiting crimes against humanity

nocturne olive
rough bloom
#

in theory you can also make all bindings that don't support inferring the struct layout from the definition (like whatever daavko is doing) invoke a C compiler to find out neuroPogHD

rigid timber
real sierra
nocturne olive
rigid timber
nocturne olive
#

Well try to make the changes make it so the assumption is guaranteed to be true since if JNA makes that assumption it can be semi-safely assumed other language bindings make the same assumption

rigid timber
#

honestly I'm surprised nobody brought it up earlier

nocturne olive
#

Just don't break my bindings I don't want to deal with them any more I just want to make a Chess bot

olive sable
rough bloom
rigid timber
#

I mean, it probably does, but I wouldn't know

nocturne olive
#

I don't know, just make sure it works with all the existing bindings

#

Don't break stuff for no reason

#

If you can avoid breaking stuff, then do so

rough bloom
#

I don't think I've ever really looked at JS bindings to C APIs

#

it's JS though, so surely there's a way Clueless

rigid snow
#

fyi bun ffi embeds tcc

nocturne olive
rigid snow
rigid timber
#

Deno specifcally, JS has no specific standard for FFI

rigid timber
nocturne olive
#

So if you could just confirm you'll try to not break things I would be satisfied and could sleep

rigid snow
#

compat wise definitely go with node bindings but they're a pita

safe path
#

holy shit doom emacs is so much easier to use than whatever I had going on with my config

rigid snow
real sierra
#

the changes should be minimal, and if you aren't doing anything that relies on the particulars of the move struct layout it should be okay

nocturne olive
#

Well my code relies on its size

#

And probably anything else that reads the moves array

olive sable
#

if you're cold, they're cold, put them in the chess api

real sierra
#

it's necessary to ensure that bindings will work the same on all platforms, and thus that they'll work on my system

#

if your system happens to work the same as mine already then it probably won't affect anything

#

if it does affect something then your bindings would've broken on my system

#

that's my understanding

nocturne olive
#

Well since everyone's bindings so far seem to work fine make the changes reflect what is happening with the bindings now rather thann doing something that breaks things

real sierra
#

I'm not trying to make changes that break things that should obviously not be the goal

rigid snow
#

regardless if it’s v8 or not

nocturne olive
sage crag
#

need to make a bindings generator

#

:mhm:

opaque sigil
#
diff --git a/src/main/kotlin/MoveByPointer.kt b/src/main/kotlin/MoveByPointer.kt
index 8513792..9e0e346 100644
--- a/src/main/kotlin/MoveByPointer.kt
+++ b/src/main/kotlin/MoveByPointer.kt
@@ -16,6 +16,10 @@ open class MoveByPointer() : Structure() {
     @JvmField
     var castle: Byte = 0
 
+    init {
+        setAlignType(ALIGN_NONE)
+    }
+
     fun toMove(): Move = Move(this)
 
     override fun toString() = "Move(from=${from}, to=${to}, promotion=${promotion}, capture=$capture, castle=$castle)"

here, problem solved enub

rigid snow
nocturne olive
sage crag
#

we just had this conversation

#

not possible

nocturne olive
#

What do you MEAN not possible?

sage crag
#

struct information only exists in the .c file

rigid snow
#

yeah, it has to be reflected in the consumer code

rough bloom
opaque sigil
#

at that point just remove the alignment

sage crag
opaque sigil
#

the speed difference is negligible at best

nocturne olive
#

Well removing the alignment would 100% break stuff

sage crag
rigid snow
#

are we talking about the move struct

rigid timber
#

yes

#

that's the only struct that any of the bots can actually interact with

#

everything else is behind pointers

rigid snow
#

yeah it’s in an array if you change that you should pad

rough bloom
real sierra
#

well I'll let you all figure out how you want it to be fixed given you, the bindings maintainers, are the main stakeholders here

nocturne olive
#

Yeah, the one annoyance that annoys binding makers

rough bloom
rigid timber
rough bloom
real sierra
#

performance impacts from changing the move struct are unimportant given it applies to every API user

#

ultimately, the move struct being a byte or two larger is not going to be what makes your bot win or lose

#

so don't worry about performance

rigid timber
#

glueless but I need every nanosecond

real sierra
#

compatibility is the key issue here

sage crag
nocturne olive
sage crag
opaque sigil
#

if you're going to break anyone's code go break everyone's at least

nocturne olive
rigid timber
nocturne olive
#

I just want my code to work

sage crag
#

ultimately only you are affected if you dont want to update them evilSmol

nocturne olive
#

Well I expect the API I was told would not change, to not change and explode things, an avoidable breaking change is dumb

opaque sigil
#

do you depend on the actual size anywhere explicitly because from what i saw going through the kotlin bindings it's all up to jna to figure out

#

which requires exactly one line to be added

rough bloom
opaque sigil
#

or 3 with some nicer formatting

nocturne olive
#

And restarting stuff

#

I hate restarting stuff

sage crag
trim valve
#

glueless note to self, do not unprivate the repo that leaks both my school and my home coordinates down to the meter

sage crag
#

or something

opaque sigil
opaque sigil
nocturne olive
#

Well then simply make it be what JNA thinks it is

nocturne olive
#

Why remove alignment when you can just make the alignment consistent instead?

rigid timber
opaque sigil
#

jna thinks nothing

#

it just uses whatever alignment you give it

sage crag
rough bloom
nocturne olive
opaque sigil
#
diff --git a/src/main/kotlin/MoveByPointer.kt b/src/main/kotlin/MoveByPointer.kt
index 8513792..3640110 100644
--- a/src/main/kotlin/MoveByPointer.kt
+++ b/src/main/kotlin/MoveByPointer.kt
@@ -4,7 +4,7 @@ import com.sun.jna.Pointer
 import com.sun.jna.Structure
 
 @Structure.FieldOrder("from", "to", "promotion", "capture", "castle")
-open class MoveByPointer() : Structure() {
+open class MoveByPointer() : Structure(Structure.ALIGN_NONE) {
     @JvmField
     var from: Long = 0
     @JvmField

new diff, there you go

sage crag
#

for one breakage now

#

that is easily fixed

nocturne olive
#

I just hate dealing with these kinds of things when I just want to have fun and make a Chess bot

real sierra
#

everyone does, but not adding this change means some of those bots could fail to run in the final tournament when submitted if the bindings only work on specific platforms

sage crag
real sierra
#

that's the risk this change would address

nocturne olive
#

I did not sign up for stressing out about memory alignment

trim valve
#

then don't stress about it??????????

sage crag
#

you change one (1) line

#

and be done

nocturne olive
#

Well then keep the memory alignment

trim valve
#

everyone here seems to be suggesting you need to make a one line change

nocturne olive
#

So I don't need to stress about it

trim valve
#

that is not stress worthy

sage crag
nocturne olive
#

I don't even know any more, I'm too tired for this mess and dealing with more versioning mess

sage crag
#

are the bindings public? can someone just submit a PR?

nocturne olive
#

Updating this stuff is a whole massive process that is a worthy competitor to the post-karaoke sync

trim valve
#

what

sage crag
#

what, git pull?

trim valve
#

post-karaoke sync literally is one shell script for me vedalHUH

real sierra
#

I think people here would be very happy to help with changes if they do end up being needed

rough bloom
nocturne olive
sage crag
#

you only need to recompile the bot you are working on

nocturne olive
sage crag
#

and they are prototypes yes?

nocturne olive
#

Most but I like to compare them

#

Like if MK1 ver10 can beat MK1 ver 8

sage crag
#

ok so, you made the issue neuroExplode

final tinsel
rough bloom
#

certified spacebar heating moment

nocturne olive
#

I don't know, manually going in and replacing the bindings related class files seems like a massive pain

nocturne olive
#

No

sage crag
#

one (one) line in fact

nocturne olive
#

At least 9 * classFileCountInCompiledBindings files

#

Manually replaced in JAR files which is also fiddly

real sierra
#

I think super box is saying the old bots are jar files right now, and they don't have the source code that built them, so they would need to modify the jar contents directly

nocturne olive
#

YES

sage crag
#

yeah but, those bots wont be any different

#

you dont need to recompile it

#

just keep two versions of the bindings

real sierra
#

unless the .so is built in

sage crag
nocturne olive
#

Like the fix to the castling bug

sage crag
nocturne olive
#

Because I made changes to make a new version

sage crag
#

if you used version control this wouldnt be an issue evilSmol

nocturne olive
#

Ver10 is built on Ver9 is built on Ver8 and so on

nocturne olive
sage crag
#

uhh yeah kinda

rough bloom
#

YES Git for everything

sage crag
#

no vcs => lose code

nocturne olive
#

If you change the bindings that will be a massive pain

sage crag
#

its a pain you caused yourself though

real sierra
#

I hate git too BASED but always a good idea to keep a copy of code you still use

#

I just copy to another file

nocturne olive
#

Well how could I know the bindings I was told WILL NOT CHANGE would change

sage crag
#

evilSMH its a hobby chess tournament, there are no guarantees

rough bloom
# real sierra I just copy to another file

neuroNODDERS if you don't care about Git and proper version control then at least regularly copy the folder
it won't give you branches and commits and all the good stuff but at least you have a version history
-# I do both

sage crag
#

i dont know who said the bindings couldnt or wouldnt change, but that does seem like a strong assertion to make considering bug history

real sierra
#

I apologise for changes, certainly I've worked to minimize any changes required to the chess API

#

but I will note that this is a change to the header file

nocturne olive
sage crag
#

stable bindings dont exist

trim valve
#

did shiro know alignment was a thing (to consider) at that point

sage crag
#

shiro certainly did not foresee such an issue, otherwise it would have been fixed at the time when the bindings were made

real sierra
#

the intention is to make as few breaking changes to the .c and .h files as possible

rough bloom
real sierra
#

but ultimately this is my first time doing something like this and planning ahead for the variety of issues that supporting every language and platform entails is rather challenging

opaque sigil
#

this is why you have an rfc process evilSMH

sage crag
nocturne olive
#

Well try to keep the alignment change as non-breaking as possible then, try to keep the alignment the same as whatever it most likely is now and hopefully it works for most bindings
Those that it doesn't work for fix it, those that it does carry on

real sierra
#

this is why a change log exists on the GitHub repo, in the front page readme, to document these major changes

nocturne olive
#

Why no???

#

Shiro just said as few breaking changes as possible

sage crag
#

yes, this is a pretty important change

#

forcing the struct to be packed will reduce the amount of work for everyone else and reduce the chance that it breaks when shiro has to compile it

real sierra
#

I'm open to other suggestions to resolve this but ultimately the Move struct needs to be well-defined cross-platform

rough bloom
sage crag
nocturne olive
#

Well I would think the safest option would be aligned to 8 bytes

real sierra
#

there's plenty chance that this change doesn't break existing bindings

opaque sigil
#

you end up with broken bindings in that case too Awkward

real sierra
#

and if it does, it should be a very easy fix

opaque sigil
#

if you hardcode it to 8 bytes

sage crag
real sierra
sage crag
trim valve
#

I can test the rust bindings if you want shiro

nocturne olive
#

And hours of pain and suffering to replace files in files

real sierra
#

I would've thought many systems would assume the packed size anyway, or if bindings use an FFI library that the library would just infer the field locations anyway

nocturne olive
#

I would guess most systems assume 8-byte aligned size

sage crag
#

just dont do that?

nocturne olive
#

I need to though, if I want updates to the API that fix broken stuff

sage crag
#

ultimately you lost the source code anyway so you cant submit that bot to begin with

#

since you can only submit source code and not compiled files

nocturne olive
#

Well I use those bots as test cases to see if I'm improving or getting worse

rough bloom
sage crag
opaque sigil
#

if they end up being worse you don't need them and if they end up better you can't submit them anyway

sage crag
#

you dont need to replace them or their bindings

nocturne olive
#

I don't even know any more, it's just a massive pain to deal with all this

#

I really need sleep

real sierra
#

will python ctypes for example no longer work as documented

opaque sigil
#

realistically changing it to packed will break all bindings

rough bloom
real sierra
sage crag
#

i think this is ai generated, this is garbage enub

rigid timber
#

it reads really strange

sage crag
#

iirc its just a 1 line change

#
class FFIStruct(Structure):
  _pack_ = 1
  _fields_ = [...]
trim valve
#

concerning lack of packed from bindgen

#

wait this is almost certainly a skill issue

sage crag
trim valve
#

yeah I realised

#

thanks google

sage crag
#
typedef struct {
  uint8_t field;
} __attribute__((packed)) Erm;
nocturne olive
#

Pain

rough bloom
trim valve
rigid timber
#

fwiw, sorry for breaking everyone's bindings by bringing up the alignment issue mahiro

trim valve
#

thank you C for letting me put __atribute__ somewhere meaningless and still compiling, very cool

nocturne olive
#

That's gonna cause me so much pain

opaque sigil
#

packed is explicitly aligned

sage crag
# nocturne olive That's gonna cause me so much pain
  • you lost your source code files, all you have is compiled bots
  • you cant submit them because they are precompiled
  • you can only use them for testing
  • after bindings change, you can still use them for testing, as long as you dont update their bindings
  • you wont get bugfixes, but you dont have the source code, so frankly it's your own mistake, sorry.
nocturne olive
#

So annnoyinng
I'm too tired to deal with this this took 1 hour of my meant to be sleep time

sage crag
#

you dont have to deal with it right now?

nocturne olive
#

I was way too stressed about things breaking to go to sleep, that's the main issue

sage crag
nocturne olive
#

So especially with me being tired I think I exceptionally hyperfocused on making things stay compatible

sage crag
opaque sigil
#

is there even anything stopping you from just using the old version with your old bots and use the new one moving forward?

#

am i missing something

opaque sigil
#

you only need the .so don't you

sage crag
#

yup

rough bloom
sage crag
nocturne olive
#

I don't want random broken castling moves breaking my results

sage crag
#

should have kept the source code then

#

im sorry that i lack pity

cosmic sphinx
#

i would praise anyone if they had a LLM that could play chess without hallucinating position past move 20

rough bloom
#

your old bots are already broken, they just stay broken MyHonestReaction

sage crag
nocturne olive
#

I don't even kknow any more, I just need to sleep or something

opaque sigil
#

couldn't you also keep the old header and use the new fixed c implementation

opaque sigil
#

unless shiro does some really cursed stuff inside there

sage crag
#

there are literally 0 problems

rough bloom
stark needle
#

Shiro current situation

rough bloom
olive sable
#

imma sleep

#

goodnight

stark needle
sage crag
#

shiro is in a losing position neuroSadA

nocturne olive
stark needle
final tinsel
#

man brotli compression suuuuuuuucks

real sierra
sage crag
#

brotli i found was comparable or better than zstd and lzma for packed binary data when i was testing

final tinsel
#

its for hyperspectral image compression

stark needle
sage crag
real sierra
rough bloom
#

isn't brotli the one meant for web stuff

sage crag
sage crag
rough bloom
sage crag
final tinsel
rigid timber
#

MyHonestReaction is there something other than cutechess that can find things that exist?

final tinsel
sage crag
#

my first choices are typically

  • zstd,
  • lzma,
  • xz,
  • bzip2,
  • gzip,
  • and brotli
opaque sigil
#

zstd my beloved

sage crag
#

you will need to care to set the correct compresion parameters for each compression

#

they use different numbers and it can be confusing

sage crag
sage crag
real sierra
#

i do wanna quickly confirm

rigid timber
sage crag
#

ive had both lzma and brotli outperform it on packed data

rough bloom
#

unless you need giga compression and can accept slow decompression, then mabe lzma or xz

real sierra
#

packed will for sure fix the alignment issue?

sage crag
real sierra
#

there's nothing implementation-specific about it?

#

and is it needed on the enums as well

sage crag
rigid timber
real sierra
#

enums are just a typedef and constants so i doubt it's needed but

sage crag
real sierra
sage crag
rigid timber
#

bruh

#

that's more than a little stupid from cutechess, ngl

sage crag
#

evilShrug that's how that typically works

final tinsel
#

we ideally want time efficient, space efficient, and power efficient- but we know getting all 3 is unlikely. we also need it to be reliable, as this is for a satellite

sage crag
#

time efficient is the same thing as power efficient for most machines

#

space efficiency is inversely proportional to time efficiency

rough bloom
# real sierra there's nothing implementation-specific about it?

integer and pointer sizes are still implementation-specific I think but for Move in particular there shouldn't be an issue mhm
packed fixes the only the alignment issue but everything else is already be taken care of, surely Shirley
so as a result the struct layout should be the same everywhere

final tinsel
#

time efficiency is likely what we'd be able to sacrifice most on as we could allow it to compress for longer while we arent in our downlink period

rough bloom
sage crag
sage crag
real sierra
#

NOWAYING thats possible?

real sierra
#

im learning so much about C

#

that shouldn't break anything right

#

at least to my knowledge

sage crag
sage crag
real sierra
#

OK ill just do that then

final tinsel
#
Compressor,Image specs (res/bands/depth),Iterations,Compress time total (us),Compress time min (us),Compress time max (us),Compress time mean (us),Compress time std dev (us),Original size (B),Compressed size min (B),Compressed size max (B),Compressed size mean (B),Compressed size std dev (B)
brotli,2048x1088/96/10,1,768889350.000,768889350.000,768889350.000,768889350.000,0.000,427819008,215436765,215436765,215436765.000,0.000``` 50% size reduction, dang!
rigid timber
#

well, got it to work through a batch file... still stupid, but at least it does random moves now

sage crag
#

just so ffi struggles less

#

i think its less common to be able to set the backing integer of enums in ffi

#

ctypes and rust both have that capability but others im not sure

trim valve
final tinsel
trim valve
final tinsel
#

it did take 12.8 mins.

sage crag
#

12.8148 minutes

rigid timber
#

nerd

trim valve
final tinsel
#

im sending the results to Space Software Dad so he can get that in the sheet but yea

sage crag
#

phrrr

final tinsel
rigid timber
#

after inciting an hour long discussion about struct alignment because he wanted to make JS bindings

#

which work btw

opaque sigil
#

v8 bindings? PAUSERS

rigid timber
#

Deno

#

but it's v8 under the hood so... yeah

sage crag
#

nice try

opaque sigil
#

i'll take that as a yes

rigid snow
#

mhm3^2

sage crag
#

9 == 8

#

proof by chatter

final tinsel
#

it said 9 when i typed it

opaque sigil
sage crag
rigid snow
#

v9 engine

sage crag
final tinsel
rigid snow
#

powering the all new chromium 2

final tinsel
sage crag
#

ye dipped in dust

final tinsel
#

welp imma head out now, ttyall later

sage crag
#

whenever i come here i lose years off my life due to stress of communicating with programmers

trim valve
#

don't worry

#

think about how many you gain by writing hblang

sage crag
#

0

trim valve
#

and therefore making the gods of ableos happy

sage crag
trim valve
#

at least zero is not losing

real sierra
rigid snow
sage crag
#
it's A
actually it's B
actually you're all wrong it's C

nope answer was 92

rigid snow
#

i am just starting out after all ...

jagged turtle
real sierra
#

Wokege week ago

rigid snow
#

i hav 2gb ram

real sierra
sage crag
#

confidently incorrect or being obstinate or having an issue that only exists for one person

#

or speaking to a lion only for the lion to eat your face off

#

programmers

real sierra
#

YES my issues are usually me not knowing convenient language features or not wanting to obey best practices for hobbyist test code

sage crag
rigid snow
sage crag
#

btw i dont have the compiler source code my dad left the binary to me in his will

trim valve
#

the chessapi doesn't compile for my stm32, please rewrite the entire stdlib

#

it is the only way

jagged turtle
rigid snow
sage crag
#

please patch

trim valve
#

shiro why doesn't this run on my capacitor

#

please fix

real sierra
sage crag
#

shiro the api doesnt support sending chess moves via light rays

rigid snow
#

capacitor no run SMH capacitor dumb

#

stupid

sage crag
#

please help

real sierra
#

qubits will not be supported by the chessapi

sage crag
#

quantum computers are too busted for chess anyway

trim valve
#

shrioooo can you restructure the entire api to be SOA instead of AOS so it plays 1% more nicely with simd

sage crag
#

chess is one of the problems that qc is very good for

real sierra
#

simd

sage crag
#

the most cmd shiro has in chess api is

trim valve
#

how are you gonna enforce the no simd rule

real sierra
sage crag
#

i thought the rule was no multiprocessing

trim valve
#

simd is not threads

rigid snow
#

what

sage crag
rigid snow
#

ICANT shiro

trim valve
#

konii i said that

#

tax

sage crag
real sierra
#

the actual wording of the rule is

... or otherwise run code in the background/in parallel ...

#

so no simd

trim valve
#

shiro am I banned from using bitboards

sage crag
real sierra
#

bitboards are legal

trim valve
#

because I am accessing each position in the board in parallel

rigid snow
#

NO CODE PARALLEL simd first two letter "single instruction" neuroLookUp

rough bloom
real sierra
#

are you doing simd on the cpu MyHonestReaction

trim valve
#

what

real sierra
#

if its on the gpu thats parallel to the cpu code

sage crag
rigid snow
trim valve
#

instructions must be no longer than 4 characters long neuroPogHD

rigid timber
sage crag
#

gpu compute is also simd-like to be fair

#

gpu compute is actually simt though

rigid timber
#

also what do I name my bot...

sage crag
real sierra
#

how are you planning to make gpu calls in 1024 tokens with stdlib only anyway

sage crag
rigid timber
#

well Deno has a large stdlib...

trim valve
#

eitherway shiro I think you fundamentally misunderstand what simd is

rigid timber
#

I wonder if there's webgpu stuff in Deno...

rigid snow
# sage crag bot bot

there is no fucking way you just typed that out too but beat me to pressing enter

sage crag
#

simd => perform instruction on wide register

real sierra
#

Bruhgi i know what simd is im just trying to make a point that its not allowed

trim valve
#

but why

real sierra
#

stop beating me up for semantics wins

#

i dont wanna make the rules longer over a silly clarification

trim valve
#

what if I coarce the compiler into autovectorization

#

is that suddenly simd and banned

rigid snow
sage crag
#

not as like, a semantic thing

#

but because simd is literally the same as regular execution

rigid timber
#

oh hey, Deno has @std/webgpu neurOMEGALUL

sage crag
#

except with larger numbers

real sierra
#

ah ok i was thinking gpu simd only

trim valve
sage crag
#

gpu is simt

real sierra
#

well yeah then on cpu its fine

trim valve
#

time to force target-feature=+popcnt for the execution time savings

sage crag
real sierra
#

programmers thinking tiny performance gains will decide the winner

rigid timber
real sierra
#

surely your algorithmic complexity isnt vastly more important

rigid snow
#

thank you for keeping NNs viable. this certainly will be fun

sage crag
opaque sigil
#

yeah in terms of tokens neuro7