#programming
1 messages ยท Page 206 of 1
oh i can just #define int my_int and access my_int locally its all useless
ok so question
C submissions will be compiled using gcc -Wall -std=c23 -O3 -o bot_exec bot_source.c -L. -lchess -lm (not looking for suggestions)
i wonder if it's because of internal state that needs to be kept
for C++ submissions is it sufficient to just replace gcc with g++
or are the options different
and weird platform specific implementations
though i guess the 2nd part doesn't really apply since with malloc you have different ways of getting memory pages too 
gotta see all the warnings
afaik they're pretty much the same but you have to change out -std=c23 for -std=c++23
dq if it produces any warning with these flags
oh right oops
i can probably leave that off

(though it would be funny to see)
-std=gnu++2c 
-std=rust 
rust++
my c++ ain't c++ing
heavens forbid i try to return a class that derives from another class, why of course it should naturally just try to copy the base class by default! i think???
your first mistake was using c++
why is the base class behavior taking precedent over the overriden one
someone kill me please
is it actually an override?
it is
double check the signature
i even slapped a big ole override onto it
no idea then
maybe you arent using dynamic_cast somewhere?
i saw nothing
true
i can no longer afford to have my increment and decrement on separate lines
must move into the conditions
1024 

undefined reference to typeinfo fuck my life
Welp that didn't last long
i figured it out again :D
something is wrong with the tree reroot fun
after the first turn it starts solving for the wrong side's pieces
phrr
fren

mambo, mambo, omatsuri mambo
tabu tabu yura yura, omatsuri mambo

its just spitting out garbage
is this a library issue
like
none of these make sense
at all
these are not only moves for the wrong player
but none of them are legal
wtf happened

Divers once found a strange lump of bronze in a shipwreck near Greeceโฆ but inside was something no one expected: a 2,000-year-old โcomputer.โ Known as the Antikythera Mechanism, this ancient device could predict eclipses, track the stars, and reveal the genius of a lost world. Was this proof that the Greeks were centuries ahead of their ti...
alein technolodg comprute bottom ocean anceint.
code trying to checkmate itself again 
ye funny, the mechanism itself is real though


or a controversial public figure
i physically pogchamped
string parsing is theoretically complete for my json parser
!!!
god bless std::wstring_convert
no idea what they were smoking with std::codecvt tho
I'm lazy I just use simdjson 
see i'm lazy in a different direction that leads me to doing more work

bot made illegal move
move finder problem? or an edge case when my bot is low time
no way of knowing
Okay, so Magistral Small 2509 is cracked in my testing
I believe the benchmarks indicating it beats Medium 1.1
It also uses very few tokens for simpler queries compared to Qwen 30BA3B
im so lost
so the bot explores this line in a position i gave it
info time 660 nodes 9729 info pv c2c4 d3c2 d2b1
in this position, c2c4 is mate
?
to confirm this, i tried adjusting the test input to make the move c2c4 before giving the board to the bot
and sure enough the bot says there's 0 legal moves
sooo
..?
!felloff


Funny numbers
I have no clue what that's meant to mean
@real sierra remember the functions i sent you?
they should probably be added to the general api
It means its remarkably token efficient for a reasoning model
even if its only used for bindings
which
ones that take values instead of structs
Silly silliness
I assume it's like really big or something or just useless for me
it should probably just be a node binding in the first place
24B parameters :Smadge:
or something
๐ช
Om nom nom
You've given me 33 cookies! | I've received 245356 cookies total!
Suspiciously 3090 sized model
Not like I have a tool to use it
Move
boards are passed as pointers which is fine
i dont remember the functions you mean
Mistral specifically targets 24GB cards for their releases these days
Something I very much appreciate them for
Very silly
Well I still don't have enough need for LLMs to warrant programming an inference interface
126k members means each member has given nuro an average of 2 cookies


I mostly just use Mistrals new stuff for Twitch chat translation personally
Offline and it beats Google Translate/DeepL in quality
i still don't have enough need for any llms let alone any locally runnable ones. i put $60 on openrouter on a whim half a year ago and i have only spent $6 since then
I don't need Twitch chat translations
Or Twitch chat
Poor twitch chat 
and i use actual sota models not the bad local sized ones
All they do is for (i in 1..Long.maxValue()) print(getRandomEmote())
I mean local sized models aren't bad these days unless you're using them for programming
yeah sure but i prefer to talk to humans and use llms for technical stuff
the first part they may do well
See for me its mainly quick info retrieval and translation like I said earlier, I do use cloud for programming
But for simple questions, translations and web search I'd rather have the privacy of a local model and save some money in the process
Cloud models are too pricy for me, I simply just don't vibecode
web search
<insert search engine> is right there
Eh, LLMs can usually parse the data into a form where you get a more direct answer to specifically your problem
I don't vibe code but I do use cloud models as a second opinion on stuff and to generate simple functions quickly to cut down on dependencies
I've been giving package managers the side eye of late
Silly
I personally don't use LLMs in my code editors
๐ What Super said
If I just want to grab the release date of something quickly for example or get a word definition its much nicer
let rand = rand::rng();
loop {
let emote = rng.random::<Emote>();
chat.iter().for_each(|chatter| chatter.emit(emote));
}

rand should be mutable i have failed

I have free Github Copilot as a student which helps, I probably wouldn't pay for the privilege
Rust be silly
if openrouter ever brings code completion apis those $60 will evaporate fast
somehow they still don't have code completion but have audio input and image generation
i do miss tab complete from copilot
"average neurocord member has given neurobot 2 cookies" factoid actualy just statistical error. average neurocord member has given neurobot 0 cookies. @cloud horizon who gave neurobot 126053 cookies is an outlier and should not have been counted 
If I need an LLM I just use the free ChatGPT website
@cloud horizon
If I want a fancy one outside vscode I just use lmarena

I don't mind that my stoopid questions might make their way into training data if it means free access to GPT-5-High for the rare query that really needs it

done
Silly
I've never used another model website than ChatGPT myself
If I wanted a different LLM I would program something to run locally, but I can't be bothered to do that when I don't need it

!felloff

canvas first
๐ช
Om nom nom
You've given me 6 cookies! | I've received 245358 cookies total!

๐ช
๐ช
Om nom nom
You've given me 4 cookies! | I've received 245359 cookies total!
cookie fungible
debugging hell
Yo
my janky code is breaking spectacularly
and i have no idea why
everything ive tried is working right
Show me ?
Give me list of problem u have
{
i give the bot a chess position where there is a one-move checkmate on the board
however, i see that when it explores this position, it finds more moves after the checkmate
but if i make this move on the chess board myself and give it this board instead, it correctly states there are zero legal moves
}
i give the bot a chess position where there is a one-move checkmate on the board
however, i see that when it explores this position, it finds more moves after the checkmate
which is not possible
but if i make this move on the chess board myself and give it this board instead, it correctly states there are zero legal moves
that's my issue
maybe the valid move cache is being improperly reused?
it's zero'd on making a new board or cloning one
shouldn't be shared
Maybe TRAINING
NAI TRAINING IS GOOD
MAYBE SYSTEM ALSO
MEM (HMM)
CACHE (THAT BE )
INSTRUCTORS (!)
the buffer is reused somewhere so thats just a guess
was a logical place to start
( is_checkmate() / is_game_over() and generate_moves()):
if (is_checkmate(board) || is_game_over(board)) {
return 0; // no moves after mate
}
int n = generate_moves(board, moves);
return n;
This logic will works it is generation problem
LITTERY Convert cannot be run
@real sierra i recently learn something
What !
for (;;) { continue; }
while (1) { continue; }
loop: { goto loop; }
for bytecode interpreter, last one save two token

what is this forbidden knowledge blessing my neurons rn
// Makes a new, blank board. Caller responsible for freeing.
static Board *create_board() {
Board *board = (Board *)malloc(sizeof(Board));
memset(board, 0, sizeof(Board));
clear_board(board);
board->can_castle_bk = false;
board->can_castle_bq = false;
board->can_castle_wk = false;
board->can_castle_wq = false;
board->fullmoves = 1;
board->halfmoves = 0;
board->last_board = NULL;
board->en_passant_target = 0;
board->whiteToMove = true;
board->refcount = 1;
return board;
}
// Creates a shallow copy of the given board
static Board *clone_board(Board * board) {
Board *new_board = (Board *)malloc(sizeof(Board));
memcpy(new_board, board, sizeof(Board));
new_board->bb_black_moves = NULL;
new_board->bb_white_moves = NULL;
//new_board->last_board = NULL;
if (new_board->last_board != NULL) {
new_board->last_board->refcount++;
}
return new_board;
}
think i found part of prolbem
because switch will fallthrough if you dont continue or goto loop out of it
the assumption made was that refcount is initialized in create_board so clone_board no need worry
but then clone_board overwrites refcount with the value in board
during the memcpy
so it needs to explicitly be set to 1
loop: switch (*pc++) {
/*exit*/ op(return 0)
/*print*/ op(__builtin_printf("hello\n"))
}
ye bytecode interpreter actually so easy people think it complicated 
labels can also be reused across functions 
computed goto would be fun but ye so many token 
U made own bugs ?
Y/N
phrr

Yo @stark needle
I had a weird dream where i played chess with shiro in vrchat
wpedantic
double ping to make sure it goes through
I hate most google cloud shell

eu chatters go sleep
nompe
Sam in the dream was there and laughing at me cause i suck at chess
eu chatters wake up
Eu ?
Asia โ
What I'm gonna do is
eu โ
Eat a whole package of gummy bears
no

It's an extra large one
Bro heat waves
In raining season
diabetes 
yay
My doctor said my liver values are fucked cause of schizo meds
are you actually schizophrenic or is that a figure of speech
I am unfortunately
oh
want but the big bags are no longer for sale
:(
It's not fully diagnosed yet cause it needs 6 months but my doctor told me it's obvious and unlikely to improve

rip
I just take it in a fun way cause what else am i supposed to do lol
good, embrace it
im packing the bytecode into 64 bit literals to save space
but this means that endianness will affect the order the bytecode is interpreted

will the vm be LE if my main system is LE

cuz i have no idea how to check on the vm 
moderate endian
actually
i have no clue how to check on my main system either
both systems are x86 i believe so
should be LE
on both
not really, most of the work is still being done by c
the art of making a performant vm is to delegate more of the work to the host machine 
bytecode is 0x0201, this is the whole vm
its not really a big deal to get to 83% of c printf performance when all the vm is doing is handling a loop and a native printf call


#define op(...) case __COUNTER__: __VA_ARGS__; goto loop;


ye downside it mean that the declaration order is important for the bytecode interpreter
if i swap instruction by mistake whole program break
but save so many token

ive identified the issue
somehow, i'm not undoing all the board moves im making
idk what i changed to cause that
its not the simulate function 
somewhere else...

the spacing on something like tree ->moves[i] doesnt matter right
whitespace is a suggestion in c

for (int i = 10; i --> 0;) printf("%d\n", i);
my brain is so fried
idk where the issue is
it all loks correct

it's only sometimes that it changes too? 


the i --> 0 part is kinda evil
also unnecessary
no save token
--i
no no its different
can change to --> 5 
and 0 is treated as false
i--:
9
8
7
6
5
4
3
2
1
0
i prefer --i tbh
++i preincrement i++ postincrement
i see why i was thinking --i instead of i--
it was because of the oppositev version i used
@real sierra what do, my program is cursed and compile only on some compiler
for(i=-1;++i<64;)

in that case the ++i makes it go from 0 to 63 instead of 0 to 64
i compiling with -std=c23 -Wall -O3
on both

both clang
but godbolt doing funny

(shiro did not get it)

while_ moves-- bclose
chess_undo_move no_args_after_board
__builtin_printf("undid move, need to undo %d more\n", moves);
}
ive been using structures like this
no worky right
oh sorry let me unmacro all that
while (moves--) {
chess_undo_move(board);
printf("undid move, need to undo %d more\n", moves);
}
but
this no worky
because even if moves is already 0
it has to evaluate the condition
which will drop moves to -1
Click this link https://www.boot.dev?promo=SHEAFIFICATION and use my code SHEAFIFICATION to get 25% off your first payment for boot.dev!
Thank you to boot.dev for sponsoring this video.
There's a dichotomy between programming languages.
Some languages are interpreted, and others are compiled, and comparisons between the two often lead to a com...
It was made to ruin your life
anyway
i bet if i move the move-- out of the condition
problem disappear
tragic tho because now my token count go up by 1 
Regression progression
actually it go up by 2 
try --move
the semicolon


if move 0 entering loop
it still decrement move
which bad
because condition always evaluated at least once

while (move-- > 0)

waitge
lie
ye
while(move & --move) 
while (moves--)
chess_undo_move(board),
printf("undid move, need to undo %d more\n", moves);

use do while

int main() {
int moves = 0;
do __builtin_printf("%u\n", moves); while (moves--);
}
print 0
int main() {
int moves = 10;
do __builtin_printf("%u\n", moves); while (moves--);
}
print
10
9
8
7
6
5
4
3
2
1
0

good news
+2 not worth 
I'm curious, what are you doing shiro?
pain suffering
chess is side effect not main goal
entries have a source code limit of 1024 tokens
ive put my bot together to help test and am trying to make it fit in the limit
it like fitting elephant in suitcase tho
so, like code golf?
yeah
but tokens instead of source code len means you dont have to minify it to an illegible mess at least 
got it, pretty interesting
for example look at this beautiful function of mine
> counting tokens
> means you dont have to minify
> source code should be readable
> 
its readable
#define best_score_eq_best_score_gt_score_best_score_or_score_sc best_score = best_score_gt_score best_score : score;
This explains the use of macros
thats not equality its assignment 

when i read it aloud tho, i read it as equals

no you have to write as best_score_ass_best_score_...

fake math major 
i wonder how long this is with the macros expanded

deletes my source code
ooo konii right tho
lets see
shiro@chess-box:/stg/backend/api/c$ cat test.c | wc -c
12011
shiro@chess-box:/stg/backend/api/c$ gcc -E test.c | wc -c
47791

I haven't touched c in so long, that seeing it makes me feel old
that includes headers

remove and recount
ill comment out the headers


shiro@chess-box:/stg/backend/api/c$ gcc -E test.c | wc -c
7845
smaller..?
ye wc
ye wc

sym_super_symbol -> { } {}
write to file and token count
almost as if not including headers means those aren't preprocessed
| java -jar toknt.jar /dev/stdin

shiro@chess-box:/stg/backend/api/c$ java -jar /stg/backend/token_count/toknt-assembly-0.1.0-SNAPSHOT.jar ./test.preprocessed
?

needs .c?
shiro@chess-box:/stg/backend/api/c$ java -jar /stg/backend/token_count/toknt-assembly-0.1.0-SNAPSHOT.jar ./test.preprocessed.c
1587

not bad
i think thats a decent token compression ratio
can i compile the .so with -O3 ????
i havent been, i wonder how much performance it's cost me
@sage crag 
Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos.
you were sure you werent using those right

yes of course
not in this vm
cost too many token
not worth performance gain unless i have token to spare later
computed goto cool technique
void *labels[] = {
&&erms, &&ermies
}
goto *labels[*pc++];
erms:
return 0;
ermies:
printf("hello!\n");
goto *labels[*pc++];
just cost lot of token
fast for bigger instruction sets but can be slower for tiny instruction sets since goto
computed goto have good performance characteristic generally especially for vm with simple instructions
since branch prediction
ye
damn cpus with their annoying crutches
nya nya nya
computed goto faster than function ptr LUT too
cant remember why
probably local stack + inlining
#define D x(erms, return 0;) x(ermies, printf("hello!\n"); goto *lables[*pc++];)
#define x(a, b) &&a,
void *labels[] = { D erms };
goto *labels[*pc++];
#define x(a, b) a: b
D
more tokens but less with more opcodes 
how do i get 5 more tokens 

not use seem painful
koni got more simple
less token
switch

invisible

tokens
where are teh tokens
i cant find anywhere to save even one token
well thats a lie there's still stdbool
but thats permanent
why stdbool anyways
stdbool was there when i needed it most

we have a bond
its ok i found a new macro 
just had to rename some variables
anyways time to figure out how chayleaf's token counter works so i can set it up
true false
saved 3 tokens

https://github.com/chayleaf/toknt
go to latest commit's ci job and it should have a jar artiffact
just need 2 more
then java -jar toknt.jar file.c
...but why

1, 0
include stdbool in chessapi.h
so you dont have to include it in the main program

# include < stdbool . h > 

you can also remove stdint this way

doesnt chessapi include stdbool 
good thinking konii
ye
koni smart
thats what konii pointed out
so i can remove stdbool
and still get my bools 
ty chessapi
koni already use
1019 tokens 
btw shimo
not seeing a jar artifact anywhere in here
uint8_t *pc = (uint64_t[]){0x201};
can you see if this compile
on your machine
it compile on my machine but not on godbolt
i go to latest commit i see files changed
no jar file
i go through entire repo
no jar file
i try
i would not have found it without that screenshot wow
shiro@chess-box:/stg/backend/api/c$ gcc -Wall -std=c23 -O3 -o bruh bruh.c -L. -lchess -lm
bruh.c:3:15: error: initialization of โuint8_t *โ {aka โunsigned char *โ} from incompatible pointer type โuint64_t *โ {aka โlong unsigned int *โ} [-Wincompatible-pointer-types]
3 | uint8_t *pc = (uint64_t[]){0x201};
| ^
different size?
noe not problem me
u use same gcc opts?
main.c:38:10: warning: incompatible pointer types initializing 'uint8_t *' (aka 'unsigned char *') with an expression of type 'uint64_t[1]' (aka 'unsigned long[1]') [-Wincompatible-pointer-types]
38 | uint8_t *pc = (uint64_t[]){0x0201};
| ^
buildPhase = ''
tcount main.c
mkdir -p $out/bin
cc main.c chessapi.c bitboard.c -o $out/bin/${name}
'';
env.CFLAGS = "-std=c23 -Wall -O3";
you may be answering this question a lot if there aren't instructions anywhere 

git ci
or actually i guess im probably answering this question a lot 
basic 

me use clang
smh i don't work a job for this stuff
neither do i 
my condolences
oof ouch owie my bones
dus t
good move 
no you are t
im so confuse
my bot still trying to lose as white
but won anyway
?
i think the checkmate finder is working but the rest isnt

inting on purpose to reduce the opponent's guard and find a checkmate in their opening
its a really weird checkmate too
0 token 
shh
i've removed everything unnecessary
can you make it negative pretty please
ye just add 1.844674407370955e19 token

true
ye that nopy
evil laugh for undisclosed reason
i wonder why it suddenly increased the tokens though
nopy ๐
nopy ๐
are you including anything
ye remove includes
๐ท๐
is problem?
ye ye problem
how would it be imported twice
i invite you to
include paths are currently not set up properly because i have still never run this lol
pragma once non-standard 
nopie
clang gcc
YIPPEE multiline macros don't cost extra
msvc
In the C and C++ programming languages, #pragma once is a non-standard but widely supported
i can make nice looking code
--wikipedia
you can use ifdef but honestly just do pragma once 
can
#ifndef ERM
#define ERM erm
// library here
#endif // ifndef ERM

i do

#ifndef ERM
#define ERM
// library code
#endif // ifndef ERM
noe ERM macro
ERM macro for erm
because when i compile
actually it updated source file but
sadgi
bred do this too
i dont know what any of that means
all roasting me 
shimo
i should just take my header back
too late i already save

everyone just ask for code so can bulli me 
forehead sticker
ok interesting so with all the defines and includes commented out the difference is just 3 tokens between tcount and toknt
hmm
this is so frustrating 
when bot play white, is cracked
ish
but when play black, sucks
maybe it's the evaluation function?
chess eval function evaluates black positions as negative
flip sign when playing as black

^
,
oh so -1 is considered 1 token in tcount, while in toknt it's 2 tokens
so all negatives are probably a bit extra tokens now
also noticed that "" went from 2 tokens to 1 token
#define n1 -1
sym
@tender river fix 
little tiny change
what does the standard say
so are all strings 1 token
the standard say konii opinion correct at all time


should i stop using <> in imports and switch to ""

wait you can just do that?
i think it optional which you use
damn ok
just convention to use <> for builtin
noe
thought <> was for standard imports and "" was for local imports
cant use <> for local import
oooh interesting
can use either for standard import
no no
prefixed or something 
konii right actually
"" will still check standard directory, it just checks local first
so switching to "" is better
standard says less work for me 
correct standard
standard say less more work for you alway




made debug output for bot
can see entire game tree now
wonder if can make output json...


i wonder how gcc implements this
since clang presumably just uses the existing types from llvm
c already had bitfields
so i dont think its that much more effort
i don't do this properly since i treat preprocessor tokens as regular tokens
but i dont care 
i disregard the standard when it says i need to do more work


header name preprocessing tokens are recognized only within
#include and #embed preprocessing directives, in __has_include and __has_embed expressions,
as well as in implementation-defined locations within #pragma directives. In such contexts, a
sequence of characters that could be either a header name or a string literal is recognized as the
former.
shiro i'm not implementing this 
Right 
My favourite part about #pragma is the Pragma macro
350 people in https://discord.com/channels/574720535888396288/1067400152698077194 is crazy
canvas
hey
can someone sanity check me
(0xff & 0x010303050900 << P)
what does this return for P from 1 to 6
im starting to think this is wrong
actually this is wrong in so many ways
wtf 
0 0 0 0 0 0 you're welcome 
is this one different
nice
neural
things like 0x14125fa9bul are one token right
vm
should be
(uint8_t[]){0x00, 0x01, 0xED, 0xB7, 0x91, 0x01, 0x02, 0x02, 0x01};


its actually doing
ldr $1 2382829
stm [2] $1
where $2 contains an address to an 8 byte section of memory
and what im doing here is printing out:
*pc, regs[1], *ptr (where $1 == regs[1], *ptr == [2])
3 instructions
yay
already at 192 token


havent optimised tokens at all though
yea ur gonna have to compress those instructions big time
also im encoding in bytes not 64 bit literals for now
ya that'll already be an 8fold increase in code space
9/2 fold
also also havent implemented the fancy bytecode format
ideally i would be using the top one for space but its so much effort

if you're really careful with code gen, you could try to generate repeat sequences of instructions aligned to the 64-bit word size
by padding with no-ops or something
codegen 
then you could #define multiple 64-bit values at a time
im writing it myself 

#define leb128_r ({uint64_t o = 0, s = 0; uint8_t b; do b = *pc++, o |= (b & 0x7F) << s, s += 7; while(b & 0x80); o;})


only globals

i fixed bot again
now its wicked good as white
lets see how it plays as black 
i find it amusing that if my bot runs out of time it just plays the opponent's last move 
results inconclusive but it looks like it plays quite well as black now, idk if it can find mates tho
5head play holy
the rook is hanging but if the knight moves, it dies because the only tile it can escape to is guarded by bishop
nerd play
#define leb128_r ({uint64_t o = 0, s = -7, b; do o |= ((b = *pc++) & 0x7F) << (s += 7); while(b & 0x80); o;})


why you doin that
im actually pretty sure i know why
but it dont make sense either way
#define leb128_r ({uint64_t o, s = -7, b; while(b & 0x80) o |= ((b = *pc++) & 0x7F) << (s += 7); o;})
im genuinely sorry for this

this code is vile
and it works 
b and o are uninitialised 
is that safe 
variable size integer

read it
from memory
that is macro to read it

im scare
there must be a worse way to do this
features GAINED
im not sure unfortunately, i imagine there's some kind of web api
@lament igloo know anything?
there was an endpoint /current
i would NOT want to know more cus cursed code and network requests 
no wonder why the site couldn't handle that much ppl


















C23 has _BitInt
