Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2023-05-13 00:00:00Z and 2023-05-14 00:00:00Z
Avatar
what was the link of ddnet source code wiki?
Avatar
@Learath2 Can u fix xpanic, and add NX|city and NX|Lvl ?
Avatar
chillerdragon BOT 2023-05-13 05:58:42Z
mood (@Learath2)
Don't ask me. I'm sitting alone in the dark having a drink while talking C++ for the maybe 100th weekend in a row. I clearly did something wrong (@kio)
06:00
@kio: you are not the Russian sedonya Ki-o guy right?
Avatar
Avatar
chillerdragon
mood (@Learath2)
Xd
Avatar
Avatar
chillerdragon
@kio: you are not the Russian sedonya Ki-o guy right?
I'm beautiful italian
Avatar
@Ryozuki help rustfmt dont work, even tho it builds fine, it happened out of nowhere, i changed completely unrelated code wtf
Avatar
it builds fin?
09:10
mm are u on nightly
09:10
i blame it on a nightly bug then
Avatar
ok
09:11
funny and weird xd
09:13
rustfmt 1.5.2-stable (84c898d 2023-04-16) even broken with stable
09:13
lmao
Avatar
lol xd
09:27
report it
Avatar
yeah i guess i have to
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
wtf is this just chatgpt but for github
Avatar
June 2023 ends Ubuntu 18 LTS standard support, I think that was our deadline? ^^
10:34
i tried to replace the lock with new stuff, but i see its interwined with clang thread safety stuff so i got lazy
10:34
if we just used rust we would have that already
10:34
AngryGrr
Avatar
june
10:39
then ubuntu 18 end of support
Avatar
lets do a hackathon
10:39
c++20 hackathon ddnet
10:39
xdxd
Avatar
i wouldn't even know what to replace tbh xd
10:41
except counting semaphore
10:41
too bad and sad that modules arent a thing
Avatar
all issues are boring
Avatar
Avatar
Ryozuki
all issues are boring
#3411
Avatar
If anyone wants to summarize the discussion, feel free to. I just wanted to create the issue now.
Avatar
it's THE issue
Avatar
@heinrich5991 pls look at https://github.com/ddnet/ddnet/pull/6560 sometime
This is a proposal for replacing EntityEx with new netobjects, like suggested in #5860. Adds a new DDNetPickup that includes switch number a new DDNetProjectile that replaces the old one (which is...
10:52
@Jupstar ✪ i should just bors r+ it gigachad
10:52
@Jupstar ✪ since only u, me and robyt are active lately
10:52
we can taker over control of ddnet
10:52
🙊
10:52
evilpatrick
Avatar
no point in upgrading to cpp 20 until all the code is even cpp at all LOL
Avatar
lets convert ddnet to 3d game quick
Avatar
When deen isn't home
Avatar
Avatar
Ryozuki
@Jupstar ✪ i should just bors r+ it gigachad
I mean you are allowed to, I intended to take a look at it this evening
Avatar
Avatar
Learath2
I mean you are allowed to, I intended to take a look at it this evening
insecurity hits hard
Avatar
Avatar
Ryozuki
we can taker over control of ddnet
yes, that's basically how it works (this and the previous line)
Avatar
rly? xD
Avatar
yes
11:41
hm. maybe not completely? I can see myself getting out of my sleep if you do something very not aligned with my values ^^
Avatar
haha xd
11:42
i dont bors many stuff in fear a heinrich comes at night and haunts me
11:42
btw we should remove bors
Avatar
@Ryozuki go #6558
Avatar
bors comments The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. For more help, visit the forum. If you ...
Avatar
Avatar
Ryozuki
btw we should remove bors
We have an issue for it. I think we wanted to wait until github merge queue gets out of beta
Avatar
@heinrich5991 just to know, does the svs still run on latest master?
Avatar
try out how well it works
Avatar
servers
Avatar
Avatar
Ryozuki
@heinrich5991 just to know, does the svs still run on latest master?
Latest deployed master. It's not auto
Avatar
explain pls
11:43
what does that mean xd
Avatar
They don't run a tag
Avatar
sometimes deen or someone else deploys a newer version
Avatar
many ppl auto deploy
11:43
ah ok
11:43
so no need to worry if smth breaks
Avatar
well, at some point it's going to be updated
11:44
if it's still broken then, it's bad
Avatar
Wait, I think I see a bug
11:45
Nvm it's sane 😄
Avatar
sane bug xd
Avatar
i mean yeah
11:46
i meant more as in we have time to fix
Avatar
yep
Avatar
how can i use a cfg in a subfolder relative to the game or appdata location
11:56
binds/x.cfg
11:56
exec didn't seem to like that format
11:56
nvm
11:58
can i use relative paths in my cfgs
Avatar
@Learath2 u won little human
Avatar
can cfgs have arguments
Avatar
Avatar
Ewan
can cfgs have arguments
Nope, but that sounds like a cute idea
Avatar
m_aInputData 😠 here we go again
Avatar
Avatar
Learath2
Nope, but that sounds like a cute idea
can we set/get variables
Avatar
Avatar
kio
m_aInputData 😠 here we go again
@Learath2 tell me 😢
Avatar
changing map bg entities doesn't seem to work
Avatar
Avatar
Ewan
changing map bg entities doesn't seem to work
what are u doing?
Avatar
changing the entities map backgrounfd
Avatar
there isn't a setting?
Avatar
the setting doesn't update
12:14
someone chained lazy
Avatar
not really good
Avatar
@Learath2 however i tried last night's thing and anything i do calling m_pClient usually crashes the game
Avatar
Avatar
kio
@Learath2 however i tried last night's thing and anything i do calling m_pClient usually crashes the game
You should be doing things inside hooks usually
12:51
You are probably using something before your component is registered
12:51
how i must register it
12:52
it extend ccomponent already, where i must tell to the client my juicy class is a component?
12:53
a simple line 😦
Avatar
Avatar
kio
a simple line 😦
Where do you call this function?
Avatar
from my class
12:55
Avatar
Avatar
kio
Click to see attachment 🖼️
That's not a call, that's a declaration
12:57
inside test i call it
Avatar
You call test inside test?
12:57
You don't, I can see it's definition above
12:58
old include
Avatar
Where is this function you've showed the declaration and definition of called?
12:58
Where do you do test()
Avatar
oh the call
12:59
inside controls because i was trying other function before
Avatar
Show me
Avatar
Ok, this isn't how this works. You need to create your component where all the others are created and registered
13:06
class CGameClient : public IGameClient { public: // all components (edited)
Avatar
jesus christ
Avatar
there u mean
Avatar
yes add it there
Avatar
errors letsgo
Avatar
wtf i added something sus in gamecore
13:15
ok seems to have fixed something now i see, last night was tarti i did something weird
13:16
prank
Avatar
I was just wondering if it was possible to change the background color of a map to cycle night/day throughout the day? of course with a reload of the map at a fixed time every day. I could've put this in the mapping channel but I don't know if it's currently possible in ddnet
Avatar
ChillerDragon BOT 2023-05-13 13:17:19Z
syncing animations is kinda broken atm
13:17
but having a 12h long animation that loops and changes background color is very easy to do
13:17
sync it to a time or have it work the same for all clients etc is tricky
Avatar
oh yeah I see
13:18
would be cool tho
Avatar
ChillerDragon BOT 2023-05-13 13:18:51Z
to have it synced to real life day time?
Avatar
ChillerDragon BOT 2023-05-13 13:19:13Z
also comes with timezone issues but yes would be cool
13:19
and would also allow to map clocks
13:19
but the whole sync think is totally messed up right now
13:20
#1318 #1610 #1214 #755 #879
Avatar
chillerbot BOT 2023-05-13 13:20:53Z
Animations with checked "Synchronised" option don't reset on going through start.
Avatar
ChillerDragon BOT 2023-05-13 13:21:04Z
some of the issues tracking how bugged it is xd
13:21
ah shit the bot can only do one issue
Avatar
çljaşljgsljdflhflkgherlskfjgşeldjzflkdjxlgdfhcblfjkbvkvjkbjagfdhbvıbhfzudhlbh
Avatar
ChillerDragon BOT 2023-05-13 13:23:07Z
drunks
Avatar
@Learath2 ok done but error for recursive include, how can i use CGameClient elements without import his class, something to do in gameclient.cpp because we declared my class there but what mhhh
Avatar
Sorry, you'll have to wait for someone else. I'm busy
Avatar
ChillerDragon BOT 2023-05-13 13:24:28Z
@kio send code repo
Avatar
I once again beg of you to learn some C++ first
Avatar
ChillerDragon BOT 2023-05-13 13:24:52Z
u can do a fake class definition like class MyClass; in the beggining or include guards etc
13:24
i need to see some of you code
13:25
is it pushed somewhere @kio to like github?
Avatar
there's no need to forward declare
13:26
just use components as normal
Avatar
ChillerDragon BOT 2023-05-13 13:27:15Z
what is the exact error message?
13:27
@Ewan do you know what he is doing? xd
Avatar
he's just making a component
13:27
that's the thing he's struggling with
Avatar
ChillerDragon BOT 2023-05-13 13:27:49Z
that much i also figured
13:27
but how can it trigger recursive includes
Avatar
Avatar
Learath2
Sorry, you'll have to wait for someone else. I'm busy
nooo my love
Avatar
Avatar
ChillerDragon
is it pushed somewhere @kio to like github?
nop
Avatar
Avatar
Ryozuki
i tested it and i dont see anything wrong
second tee has no idea that the tema is in practice, it cant change teams anymore even if startline hasn't been crossed (or any tee teleported)
Avatar
@kio
  • in gameclient.h, add an #include do your kehub component and add an instance of your component to the public member defines in CGameClient. should look like this
class CGameClient : public IGameClient { public: // all components CKillMessages m_KillMessages; CCamera m_Camera; ... KeHub m_KeHub; ... }
  • in gameclient.cpp, find the m_vpAll.insert call in CGameClient::OnConsoleInit() and add your kehub instance in the same manner
m_vpAll.insert(m_vpAll.end(), {&m_Skins, &m_CountryFlags, &m_MapImages, ... &m_KeHub, ... &m_GameConsole, &m_MenuBackground});
(edited)
13:34
your component will now be initialized at the appropriate time, automatically
13:34
inherit CComponent methods to add functionality
Avatar
the problem is that chillernigerian
Avatar
Avatar
Robyt3
the question is where do you even render the text exactly? would be distracting if it keeps moving while the tee moves
maybe top left of tune zone or screen, whichever is on screen
Avatar
Avatar
Learath2
Because we atleast have one academic here and academics love matlab
hello there, i used matlab during my cursus yes
Avatar
Avatar
Ewan
@kio
  • in gameclient.h, add an #include do your kehub component and add an instance of your component to the public member defines in CGameClient. should look like this
class CGameClient : public IGameClient { public: // all components CKillMessages m_KillMessages; CCamera m_Camera; ... KeHub m_KeHub; ... }
  • in gameclient.cpp, find the m_vpAll.insert call in CGameClient::OnConsoleInit() and add your kehub instance in the same manner
m_vpAll.insert(m_vpAll.end(), {&m_Skins, &m_CountryFlags, &m_MapImages, ... &m_KeHub, ... &m_GameConsole, &m_MenuBackground});
(edited)
why i must put it there, there is this comment // make a list of all the systems, make sure to add them in the correct render order
Avatar
it is a component and must be treated as such
Avatar
Avatar
Learath2
Anyway, any idea proprietary software enjoyers?
ok, no idea for this, imo you shouldn't use cell array
Avatar
the comment is irrelevant
Avatar
what you're trying to do exactly?
Avatar
ChillerDragon BOT 2023-05-13 13:36:40Z
bra ewan u kicked the bridge
Avatar
Avatar
Ryozuki
its sad u cant take a academic course and not be bombarded by propietary non free software
academic often forms engineers, so we gotta teach them private stuff used by companies
Avatar
Avatar
Ewan
the comment is irrelevant
okk
13:37
different error niow xd
Avatar
ChillerDragon BOT 2023-05-13 13:37:06Z
what happens if you uncomment line 5?
Avatar
Avatar
ChillerDragon
bra ewan u kicked the bridge
stupid discord messes up tabs vs. spaces while editing so when i send the message it expands the tabs too much and totally fucks the indentation
13:37
so i had to edit to fix it
Avatar
or maybe the same
Avatar
Avatar
ChillerDragon
what happens if you uncomment line 5?
cursive include
Avatar
ChillerDragon BOT 2023-05-13 13:37:57Z
this is super annoying w screenshots for me
Avatar
ChillerDragon BOT 2023-05-13 13:38:07Z
if you send me the repo in current state i send u a pr with the fix
Avatar
you nick on github>
Avatar
Avatar
Learath2
I think this control theory class will forever be in matlab tho. They use so many proprietary things, I can't imagine it existing without simulink and matlab
yeah control theory really relies on matlab and simulink because it works and is efficient. Moreover, the control toolbox furnishes a lot of functions that people can use out of the box quite easily
Avatar
is this an intellisense error or a compile error @kio
Avatar
ChillerDragon BOT 2023-05-13 13:38:21Z
my gh name is ChillerDragon
Avatar
Avatar
ChillerDragon
my gh name is ChillerDragon
compiler
Avatar
you are including CClient yes?
Avatar
C++ [build] In file included from D:/Projects/KeHub/src/game/client/components/kehub/test.cpp:7: [build] D:/Projects/KeHub/src/game/client/components/kehub/test.h:4:7: error: redefinition of 'class KeHub' [build] 4 | class KeHub : public CComponent{ [build] | ^~~~~ [build] In file included from D:/Projects/KeHub/src/game/client/gameclient.h:56, [build] from D:/Projects/KeHub/src/game/client/components/kehub/test.cpp:5: [build] D:/Projects/KeHub/src/game/client/components/kehub/test.h:4:7: note: previous definition of 'class KeHub' [build] 4 | class KeHub : public CComponent{ [build] | ^~~~~ [build] cc1plus.exe: note: unrecognized command-line option '-Wno-nullability-completeness' may have been intended to silence earlier diagnostics
Avatar
Avatar
Ewan
you are including CClient yes?
yes
13:38
now
Avatar
ChillerDragon BOT 2023-05-13 13:39:02Z
u missing a include guard
13:39
in test.h
13:39
line 4
Avatar
Avatar
Learath2
I'll go practice alcoholism, have fun making what I suspect is a bot that we'll have to ban you for 👋
please don't practice alone, it's dangerous
Avatar
ChillerDragon BOT 2023-05-13 13:39:22Z
say #pragma once
Avatar
#pragma once should work
13:39
jinx soda etc
Avatar
ChillerDragon BOT 2023-05-13 13:39:33Z
xd
13:39
i ow u soda
13:39
how to type "ow" ?
Avatar
ChillerDragon BOT 2023-05-13 13:39:52Z
no way
Avatar
Avatar
Learath2
"components" are loosely defined anyway, most anything can be a component
they offer a quick way to have something updated every game frame or every game tick, so quite convenient even for non rendered stuff
Avatar
Avatar
ChillerDragon
say #pragma once
where?
Avatar
ChillerDragon BOT 2023-05-13 13:40:39Z
line 4
13:40
test.h
13:40
line3
Avatar
but including the gameclient inside the cpp?
Avatar
ChillerDragon BOT 2023-05-13 13:40:59Z
yes
13:41
after include
13:41
or before include
Avatar
ChillerDragon BOT 2023-05-13 13:41:10Z
doesnt really matter
Avatar
ChillerDragon BOT 2023-05-13 13:41:21Z
did it work?
Avatar
one sec i must remove some shitty line of code inside some classes xd
Avatar
chillerdragbot
Avatar
im practicing pumping iron
Avatar
compiled chillerdad
Avatar
ChillerDragon BOT 2023-05-13 13:43:24Z
pog piog
13:43
very nice beautiful italian
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
sorry, i don't use vscode 😦
Avatar
Avatar
ChillerDragon
very nice beautiful italian
but now when I want to call a method of my component from another class how do I do it? I don't have to reinstantiate it right?
Avatar
ChillerDragon BOT 2023-05-13 13:44:17Z
nah
13:44
its registered in the gameclient
13:44
u say m_pClient->m_KeHub.YourMethod()
13:44
or something like that
13:44
sexy
13:44
fuck
13:44
really sexy
Avatar
ChillerDragon BOT 2023-05-13 13:44:49Z
yes yey very
13:44
thx chillerdaddy (edited)
Avatar
ChillerDragon BOT 2023-05-13 13:45:01Z
UwU
Avatar
ChillerDragon: the folk questions your chillerbot
Avatar
ChillerDragon BOT 2023-05-13 13:45:38Z
wot?
Avatar
come discord
Avatar
ChillerDragon BOT 2023-05-13 13:45:56Z
xd
13:46
wha is "the folk"
13:46
and what does questions mean
13:46
and how to come discord
Avatar
the tw folk
13:46
xd
Avatar
ChillerDragon BOT 2023-05-13 13:46:24Z
send this "the folk" guy here
13:46
to irc side
13:46
unless its 0.6 related
13:46
then tell him to update client
Avatar
its about the ingame bot xd
Avatar
ChillerDragon BOT 2023-05-13 13:48:05Z
multimap?
13:48
should i open tw?
Avatar
multeasymap*
Avatar
yeah, he wants to understand why the bot is even allowed
Avatar
ChillerDragon BOT 2023-05-13 13:48:28Z
oh i cant answer that
Avatar
lmao
Avatar
ChillerDragon BOT 2023-05-13 13:48:33Z
i have no legal permission
13:48
you as my lawyer should handle that
Avatar
i'd ban u ofc
Avatar
ChillerDragon BOT 2023-05-13 13:48:57Z
u cant as my lawyer
Avatar
xD
Avatar
ChillerDragon BOT 2023-05-13 13:49:14Z
make sure i do not get incriminated
Avatar
"the folk" guy is here. What's chillerbot-zx purpose? to exist? to pass butter? is he a test for a TAS?
Avatar
ChillerDragon BOT 2023-05-13 13:55:47Z
chillerbot-zx on Multeasymap is there to track stats
13:55
to give the block community there a ranking
13:56
you can try !top3 and !stats and !rank etc
13:56
it counts kills based on last toucher when a tee dies in freeze but only in the block area
Avatar
why not do it server side?
Avatar
ChillerDragon BOT 2023-05-13 13:57:10Z
i do not have ssh access to ddnet servers
13:57
yet
13:57
axaxax
13:57
but you can checkout my servers where it is done serer side
Avatar
Avatar
ChillerDragon
to give the block community there a ranking
imagine supporting blocking on multeasy
Avatar
why chillerbot isn't a spectator
Avatar
ChillerDragon BOT 2023-05-13 13:57:52Z
i do not like spec idk
13:58
imo spec should be removed from ddnet
Avatar
wut? why?
Avatar
ChillerDragon BOT 2023-05-13 13:58:55Z
i do not like it
13:59
its almost as bad as solo tiles or /team
Avatar
just say you dont like playing ddnet
Avatar
ChillerDragon BOT 2023-05-13 14:00:13Z
i like ddnet
Avatar
but those are like, integral parts to gameplay LOL
Avatar
ChillerDragon BOT 2023-05-13 14:00:38Z
no
Avatar
like wtf did solo tiles do wrong
Avatar
ChillerDragon BOT 2023-05-13 14:00:44Z
they hide tees
14:00
i dislike things that hide tees
Avatar
krill issue
Avatar
ChillerDragon BOT 2023-05-13 14:00:55Z
i like tees
Avatar
/showothers
Avatar
ChillerDragon BOT 2023-05-13 14:01:20Z
its also about them being untouchable
14:01
gotta touch those tees
14:02
@SSD pls do not report me to ddnet admins thanks. i think they havent figured out im doing it yet
Avatar
If chillerbot will be a spectator, he won't take up space in a 63 player server and will still be able to send messages.
Avatar
Avatar
ChillerDragon
@SSD pls do not report me to ddnet admins thanks. i think they havent figured out im doing it yet
ok
Avatar
ChillerDragon BOT 2023-05-13 14:03:50Z
he will
14:03
specs also take slots
14:04
sadly from the client side i can not avoid taking a slot and also i feel a bit bad since the server is full most of the time
14:04
the block community should really move on a dedicated server instead of mixing in with racers but i can not influence that
Avatar
maybe i am stupid but here.
Avatar
ChillerDragon BOT 2023-05-13 14:06:16Z
still taking a slot
14:06
not in the scoreboard list
14:06
but the server is still filling up
14:06
he has a full CPlayer instance and if you check the master server you can see a slot is used
Avatar
ChillerDragon BOT 2023-05-13 14:07:17Z
yes thats sad
14:07
in vanilla it kinda works tho
14:07
there are 64 slots
14:07
and 16 in game slots
14:07
so there you can use spec slots for free
Avatar
Avatar
Chairn
what you're trying to do exactly?
I was trying to feed what I got from tfdata to residue. I could avoid the cell array by using the 'v' flag, but then I need to do it 4 times for each member in this matrix
14:24
cellfun with two arguments worked very well
Avatar
Avatar
ChillerDragon
axaxax
russian?
Avatar
ChillerDragon BOT 2023-05-13 14:34:35Z
da
Avatar
@Learath2
14:42
Avatar
You know what? I'll allow it. Fizzbuzz is a good way to eliminate a lot of useless people
Avatar
wtf is fizzbuzz
Avatar
ChillerDragon BOT 2023-05-13 14:56:08Z
fizzbuzz is a trap
14:56
it gets me at least once a month xd
14:56
its a question that kinda traps you into ordering your if statements in the wrong order as not not the most specific one first and then it breaks your brain
Avatar
Print numbers from 1 to 100, except; for numbers divisible by 3 print fizz, for numbers divisible by 5 print buzz, for numbers divisible by both print fizzbuzz
Avatar
lemme try
Avatar
Put your answer in a spoiler tag incase someone else wants to try
Avatar
Avatar
Learath2
Print numbers from 1 to 100, except; for numbers divisible by 3 print fizz, for numbers divisible by 5 print buzz, for numbers divisible by both print fizzbuzz
is that a legit application question?
15:01
sounds bit too easy xD
Avatar
Avatar
Jupstar ✪
is that a legit application question?
I've heard it being asked, from atleast a couple people. But no way to know if they actually do ask it
15:02
It is just a tad trickier than it sounds, just enough to confuse someone new
Avatar
the problem is, the question is ambigious
15:03
u could say if its divisible by 3 and 5 it should only print fizzbuzz
15:03
but maybe it should print all 3 stuff
Avatar
jupstar failed
Avatar
It's probably just the way I quickly wrote it on phone. I specifically want the output 1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz... (edited)
Avatar
but in fact often i school i had the feeling that math questions were not correctly understanable
Avatar
test
Avatar
but the teachers were either too stupid or hated me xd
Avatar
Avatar
Jupstar ✪
but in fact often i school i had the feeling that math questions were not correctly understanable
Definitely. I argued with my math teacher all the time about her ambiguous questions
Avatar
#include <stdio.h> int main(int argc, char *argv[]) { int i, p; for (i = 1; i <= 100; i++) { // printf("(i:%d) ", i); p = 0; if (i % 3 == 0) p = 1, printf("fizz"); if (i % 5 == 0) p = 1, printf("buzz"); if (!p) printf("%d", i); printf("\n"); } } i hope this gets spoiler proofed
👍 1
Avatar
Avatar
ChillerDragon
its a question that kinda traps you into ordering your if statements in the wrong order as not not the most specific one first and then it breaks your brain
YEP How convenient, my system is basically those if statements, but in Python steroid
Avatar
Avatar
Ryozuki
c99?
if you're asking about me yes, it's c89 also
Avatar
im not home or i would show u the rusty way, using iterators ofc
Avatar
rust teacher
15:08
when rust interviews at Google? kek
Avatar
Avatar
zogtib
if you're asking about me yes, it's c89 also
Forgot to return int from main, unhired
Avatar
its ub?
15:08
i think it works
Avatar
Avatar
Learath2
Forgot to return int from main, unhired
you didn't specified exit value
15:09
it does print what you asked for 😉
Avatar
justatest no end for the loop
Avatar
Avatar
zogtib
you didn't specified exit value
well the convention is 0 for success
15:09
if the program didnt fail
15:09
🤓
Avatar
You should have written void main(int argc, char **argv) then
15:09
Unhirable
Avatar
Avatar
Ryozuki
well the convention is 0 for success
the actual problem is that I said it was c89
15:10
using c is a reasone to fire in my book too (edited)
15:10
gigachad
15:10
shit mobile
Avatar
Avatar
Learath2
You should have written void main(int argc, char **argv) then
yay no returns gigachad
Avatar
Avatar
Learath2
You should have written void main(int argc, char **argv) then
what would that return btw? i mean as an exit status (edited)
Avatar
it's voided
15:10
it won't
Avatar
@Learath2 c89 doesnt have a noreturn hint/marker right?
Avatar
int test
Avatar
in rust its !
Avatar
Avatar
zogtib
what would that return btw? i mean as an exit status (edited)
Up to the implementation at that point
Avatar
Avatar
Mr.Gh0s7
int test
Mfw spoiler broken on mobile
Avatar
weird spoiler magic
Avatar
Avatar
Learath2
Mfw spoiler broken on mobile
You have to tap on the left side to reveal 🙃
Avatar
Avatar
Learath2
Up to the implementation at that point
Couldn't I just sell it for c99 and we're good?
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
man, at least post the r/programmerhumor link...
Avatar
Avatar
Chairn
man, at least post the r/programmerhumor link...
why
Avatar
even chairn's calling you out
Avatar
ye my memes are from leddit
15:14
some from twitter
Avatar
justatest reddit
Avatar
i should get into 4chan
Avatar
my memes are just from whatever i find the funniest
Avatar
twitter, source of evil
Avatar
Avatar
Voxel
my memes are just from whatever i find the funniest
Oh so nobody gets those memes in Discord? cuz I do from you all 2076_pepechristmashype
Avatar
Avatar
Ryozuki
why
because that's what people do to not get credit of something they didn't do. Moreover, people might be interesting in knowing the original author or to read more comment on that
Avatar
Avatar
Chairn
because that's what people do to not get credit of something they didn't do. Moreover, people might be interesting in knowing the original author or to read more comment on that
Ye, like we all need to credit the creator of the memes, but due to the fact, that we don't know where it came from in the first place, it's not relevant to bother
15:17
Twitter stole from Reddit, Reddit stole for 4chan, 4chan stole from Facebook, Facebook stole from Google, etc
Avatar
Avatar
Chairn
because that's what people do to not get credit of something they didn't do. Moreover, people might be interesting in knowing the original author or to read more comment on that
i dont think anyone ever thought i did a meme here
15:17
also reddit isnt the original either
15:17
ill keep putting the images
15:17
im a madman
Avatar
Who's insane enough to put a license to a meme? kekW
Avatar
#include <stdio.h> int main() { int n, i; for (n = 1; n < 101; n++) { if (n % 3 == 0) { i = 1; printf("fizz"); } if (n % 5 == 0) { i = 1; printf("buzz"); } if (i == 1) printf("\n"); else printf("%d\n", n); i = 0; } }
Avatar
Avatar
Cellegen
Twitter stole from Reddit, Reddit stole for 4chan, 4chan stole from Facebook, Facebook stole from Google, etc
and discord people stole from all those. Isn't that hard to paste a link
Avatar
Yeah, it's an endless cycle of identification
15:19
It's like an open library, but even the library stole stuff
15:20
open library as in an actual book library
Avatar
then just break the cycle
Avatar
Avatar
Chairn
then just break the cycle
YEP
Avatar
Avatar
zogtib
#include <stdio.h> int main(int argc, char *argv[]) { int i, p; for (i = 1; i <= 100; i++) { // printf("(i:%d) ", i); p = 0; if (i % 3 == 0) p = 1, printf("fizz"); if (i % 5 == 0) p = 1, printf("buzz"); if (!p) printf("%d", i); printf("\n"); } } i hope this gets spoiler proofed
mfw this guy did the same thing :]
Avatar
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if(i % 3 && i % 5) printf("%d", i); else printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); putchar('\n'); } return 0; }
15:24
Here is my wasteful one, but it's so pretty 😛
Avatar
i love fizzbuzz
Avatar
Avatar
Mr.Gh0s7
#include <stdio.h> int main() { int n, i; for (n = 1; n < 101; n++) { if (n % 3 == 0) { i = 1; printf("fizz"); } if (n % 5 == 0) { i = 1; printf("buzz"); } if (i == 1) printf("\n"); else printf("%d\n", n); i = 0; } }
In C an empty argument list actually means any amount of arguments, while your declaration of main maaaybe allowed under some implementations I'm not sure if it's allowed under standard C 😄
Avatar
Oh, none asked for the program to be standards compliant! ("a program that outputs...") (Rust implementations would be impossible in that case)
Avatar
Avatar
zogtib
Oh, none asked for the program to be standards compliant! ("a program that outputs...") (Rust implementations would be impossible in that case)
never say impossible with Rust, when Ryo is around
15:28
justatest
15:29
he'll get mad or sad
Avatar
i remember watching a coding video about how to avoid too much nesting into your code, and one of them was to rearrange your if statements in your functions so that it returns the output you want after a long filter system
15:30
like have all the falses come first before the true
Avatar
Ye, any code line which triggers with "else" can go first, but also the if statements can also return, so you don't have to use "else" if the if statement shouldn't continue (edited)
15:36
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if !(i % 3 && i % 5) printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); return printf("%d", i); putchar('\n'); } return 0; }
15:36
idk if it's correct or not
15:36
I just assume it is
Avatar
#include <stdio.h> int main(void){for(int i=1;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);}
Avatar
Avatar
Cellegen
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if !(i % 3 && i % 5) printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); return printf("%d", i); putchar('\n'); } return 0; }
L6 that ! can't be outside the (, this isn't python or rust 😛
Avatar
Avatar
Learath2
Here is my wasteful one, but it's so pretty 😛
#include <stdio.h> int main(void) { int i, d3, d5; for (i = 1; i <= 100; i++) { if ((d3 = i % 3) && (d5 = i % 5)) printf("%d", i); else printf("%s%s", d3 ? "" : "fizz", d5 ? "" : "buzz"); putchar('\n'); } return 0; }
Avatar
Avatar
Learath2
L6 that ! can't be outside the (, this isn't python or rust 😛
xd
Avatar
you also forgot a bracket so it will always return
Avatar
ah shit
15:38
I'm fired I guess gigachad
Avatar
Avatar
zogtib
#include <stdio.h> int main(void) { int i, d3, d5; for (i = 1; i <= 100; i++) { if ((d3 = i % 3) && (d5 = i % 5)) printf("%d", i); else printf("%s%s", d3 ? "" : "fizz", d5 ? "" : "buzz"); putchar('\n'); } return 0; }
I checked btw, it seems gcc and clang are smart enough to optimize mine to this too
Avatar
Avatar
Cellegen
I'm fired I guess gigachad
Only hired ppl get fired
Avatar
I can be hired as a Python dev
15:40
but only for Python xd
Avatar
import fizzbuzz fizzbuzz.fizzbuzz()
Avatar
Avatar
Learath2
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if(i % 3 && i % 5) printf("%d", i); else printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); putchar('\n'); } return 0; }
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if(i % 3 && i % 5) printf("%d", i); else printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); putchar('\n'); makeMeABurger(); } return 0; }
15:40
heres my edit
Avatar
makeMeABurger() function, insane performance increase Pog
Avatar
it prevents a rare bug called hunger
Avatar
oh shit, lemme recreate the fizz fuzz in godot 4 kek
Avatar
Avatar
Voxel
heres my edit
warning: implicit declaration of function 'makeMeABurger'
🤓 2
15:42
undefined reference to 'makeMeABurger
🤓 2
15:42
collect: error: ld returned 1 exit status
🤓 2
Avatar
anyone in here done much ipc?
Avatar
i want that fucking burger omg
Avatar
i'm trying to figure out the most efficient way to send a framebuffer between processes in a portable way
15:43
e.g. no pointers
Avatar
'makeMeABurger' reference cannot be found at <stdio.h>
🤓 1
Avatar
Avatar
Ewan
i'm trying to figure out the most efficient way to send a framebuffer between processes in a portable way
how portable?
Avatar
i don't wanna send huge uchar arrays back and forth but at the same time any kind of optimization would be really expensive
Avatar
Avatar
Learath2
how portable?
can't use pointers or handles to particular graphics library framebuffer types
Avatar
Avatar
Ewan
i'm trying to figure out the most efficient way to send a framebuffer between processes in a portable way
Could you use a pipe and send all that through that?
Avatar
Avatar
Learath2
#include <stdio.h> int main(void){for(int i=1;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);}
good
15:45
now make ddnet single line
15:45
giga_chad
Avatar
Avatar
zogtib
Could you use a pipe and send all that through that?
that might be a good idea yeah
15:45
i wonder if com has a pipe mechanism or if it deems itself too abstract for that lol
15:46
cuz that's what im using atm
Avatar
what's com?
Avatar
Avatar
Ewan
can't use pointers or handles to particular graphics library framebuffer types
Shm would pretty much be your fastest option
Avatar
Avatar
zogtib
what's com?
component object model
Avatar
Avatar
Voxel
#include <stdio.h> int main(void) { for(int i = 1; i <= 100; i++) { if(i % 3 && i % 5) printf("%d", i); else printf("%s%s", i % 3 ? "" : "fizz", i % 5 ? "" : "buzz"); putchar('\n'); makeMeABurger(); } return 0; }
wait how does it return, when it's voided?
Avatar
Avatar
Ewan
component object model
it's a microsoft binary standard that defines a way for processes to communicate using interfaces & instances
15:47
what im using atm
Avatar
Avatar
Cellegen
wait how does it return, when it's voided?
int main
Avatar
Avatar
Cellegen
wait how does it return, when it's voided?
it makes me a burger
15:47
how hard is it to grasp
Avatar
oh it's inside the variable
15:47
gotcha
Avatar
Avatar
Learath2
Here is my wasteful one, but it's so pretty 😛
i wouldn't call that pretty, it's less readable and you test some conditions twice
Avatar
Avatar
Chairn
i wouldn't call that pretty, it's less readable and you test some conditions twice
You simply have wrong opinions, it's ok
Avatar
Avatar
Cellegen
wait how does it return, when it's voided?
adding void in the parameter list just tells that there's no parameters
Avatar
Avatar
Learath2
You simply have wrong opinions, it's ok
ah yes, the classical opinions can be wrong 😄
Avatar
Avatar
Learath2
Shm would pretty much be your fastest option
that also might be a good idea but i'd need a file surrogate
Avatar
Avatar
Learath2
#include <stdio.h> int main(void){for(int i=1;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);}
main(){for(;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);} In Ansi C it can get shorter I guess
Avatar
my opinions are always wrong but i stand by them anyways
Avatar
Avatar
Voxel
my opinions are always wrong but i stand by them anyways
that does not sound right
troll 1
Avatar
Avatar
Learath2
Print numbers from 1 to 100, except; for numbers divisible by 3 print fizz, for numbers divisible by 5 print buzz, for numbers divisible by both print fizzbuzz
@Ryozuki write one in rust so i know how painful itd look
Avatar
Avatar
Learath2
main(){for(;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);} In Ansi C it can get shorter I guess
this won't work
Avatar
Avatar
Voxel
@Ryozuki write one in rust so i know how painful itd look
It'd look about the same as zogtib's first attempt in C
Avatar
i is not declared
Avatar
Avatar
ReiTW
i is not declared
Ansi c implicit declarations Cool
Avatar
tf (edited)
Avatar
what about return type on main
Avatar
implicit int
Avatar
never works when i do it
15:53
bleh
Avatar
oh, I forgot a character there sorry
Avatar
yeh, forgot ,
Avatar
No forgot to add i to the arguments of main 😄
Avatar
best solution i've found yet: https://codegolf.stackexchange.com/a/75284
Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other cat...
Avatar
main(i){for(;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);} (edited)
Avatar
Avatar
Learath2
main(){for(;i<101;puts(i++%5?"":"buzz"))printf(i%3?i%5?"%d":"":"fizz",i);} In Ansi C it can get shorter I guess
code style is in depression wtf is that XD
Avatar
you need a comma between puts and printf
15:56
fizzfuzz in godot gigachad
Avatar
Avatar
Chairn
you need a comma between puts and printf
iii don't think I do
Avatar
and im not even sure your code doesn't involve UB due to i++ being in the same statement as printf
15:56
oh
Avatar
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
Avatar
ok, i get it now
Avatar
fuck xd
Avatar
parenthesis messed me
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
monkaEXTREME
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
spoiled
Avatar
mine is like 7 lines, this one is like god madafakin daaaaaaamn
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
the code is the documentation
Avatar
@Learath2 stealer of answer? https://codegolf.stackexchange.com/a/58821
Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other cat...
15:57
answer authored by @lynn
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
This is fake, you didn't utilize use divisibility::{by_3, by_4};
Avatar
if x.is_odd_or_even() { print!("\n"); }
Avatar
Avatar
Chairn
@Learath2 stealer of answer? https://codegolf.stackexchange.com/a/58821
lynn is the one who stole it if anything, that's an ancient answer from like back when ansi c was actually a thing 😄
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
you have won codegolf
Avatar
i made it in rust
16:04
but in this problems i like to go the most rusty over implemented way
Avatar
is there a maximum variable name length 😄 ?
Avatar
Avatar
Jupstar ✪
fn main() { (1..=100).for_each(|this_is_the_current_number| { let mut is_divisible_by_3 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 -= 3; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_3 == 0 { is_divisible_by_3 = true; } let mut is_divisible_by_5 = false; let mut this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 = this_is_the_current_number; while this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 > 0 { this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 -= 5; } if this_number_will_decrease_to_check_if_the_current_number_is_in_the_zero_modulo_class_of_5 == 0 { is_divisible_by_5 = true; } if is_divisible_by_3 | is_divisible_by_5 { if is_divisible_by_3 { print!("Fizz") } if is_divisible_by_5 { print!("Buzz") } } else { print!("{}", this_is_the_current_number) } print!("\n") }); } (edited)
thats what i thought justatest
Avatar
#![forbid(unsafe_code)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)] use std::{fmt::Display, println, write}; #[derive(Debug, Clone, PartialEq, Eq, Default, Hash)] struct FizzBuzzGenerator(usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum FizzBuzzPutput { Fizz, Buzz, FizzBuzz, Number(usize), } impl Display for FizzBuzzPutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Fizz => write!(f, "Fizz"), Self::Buzz => write!(f, "Buzz"), Self::FizzBuzz => write!(f, "FizzBuzz"), Self::Number(x) => write!(f, "{x}"), } } } impl Iterator for FizzBuzzGenerator { type Item = FizzBuzzPutput; fn next(&mut self) -> Option<Self::Item> { self.0 += 1; let n5 = self.0 % 5 == 0; let n3 = self.0 % 3 == 0; if n5 && n3 { Some(FizzBuzzPutput::FizzBuzz) } else if n3 { Some(FizzBuzzPutput::Fizz) } else if n5 { Some(FizzBuzzPutput::Buzz) } else { Some(FizzBuzzPutput::Number(self.0)) } } } fn main() { let epic_fizz_buzz = FizzBuzzGenerator::default(); epic_fizz_buzz.take(20).for_each(|x| println!("{x}")); }
16:05
dont @ me thanks
Avatar
@Jupstar ✪ my code better gigachad
Avatar
@Ryozuki you got a typo in "Output", your code is unsafe
Avatar
Avatar
Ryozuki
#![forbid(unsafe_code)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)] use std::{fmt::Display, println, write}; #[derive(Debug, Clone, PartialEq, Eq, Default, Hash)] struct FizzBuzzGenerator(usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum FizzBuzzPutput { Fizz, Buzz, FizzBuzz, Number(usize), } impl Display for FizzBuzzPutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Fizz => write!(f, "Fizz"), Self::Buzz => write!(f, "Buzz"), Self::FizzBuzz => write!(f, "FizzBuzz"), Self::Number(x) => write!(f, "{x}"), } } } impl Iterator for FizzBuzzGenerator { type Item = FizzBuzzPutput; fn next(&mut self) -> Option<Self::Item> { self.0 += 1; let n5 = self.0 % 5 == 0; let n3 = self.0 % 3 == 0; if n5 && n3 { Some(FizzBuzzPutput::FizzBuzz) } else if n3 { Some(FizzBuzzPutput::Fizz) } else if n5 { Some(FizzBuzzPutput::Buzz) } else { Some(FizzBuzzPutput::Number(self.0)) } } } fn main() { let epic_fizz_buzz = FizzBuzzGenerator::default(); epic_fizz_buzz.take(20).for_each(|x| println!("{x}")); }
thats what i thought too
Avatar
lol true
16:07
xd
16:07
its safe tho
f4 2
Avatar
jup's rust code is ironically hard to read ryoz's is unironically hard to read
Avatar
Avatar
Voxel
thats what i thought too
lol no
Avatar
for a rust programmer
16:07
my way is the most readable
Avatar
Avatar
Ryozuki
#![forbid(unsafe_code)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)] use std::{fmt::Display, println, write}; #[derive(Debug, Clone, PartialEq, Eq, Default, Hash)] struct FizzBuzzGenerator(usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum FizzBuzzPutput { Fizz, Buzz, FizzBuzz, Number(usize), } impl Display for FizzBuzzPutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Fizz => write!(f, "Fizz"), Self::Buzz => write!(f, "Buzz"), Self::FizzBuzz => write!(f, "FizzBuzz"), Self::Number(x) => write!(f, "{x}"), } } } impl Iterator for FizzBuzzGenerator { type Item = FizzBuzzPutput; fn next(&mut self) -> Option<Self::Item> { self.0 += 1; let n5 = self.0 % 5 == 0; let n3 = self.0 % 3 == 0; if n5 && n3 { Some(FizzBuzzPutput::FizzBuzz) } else if n3 { Some(FizzBuzzPutput::Fizz) } else if n5 { Some(FizzBuzzPutput::Buzz) } else { Some(FizzBuzzPutput::Number(self.0)) } } } fn main() { let epic_fizz_buzz = FizzBuzzGenerator::default(); epic_fizz_buzz.take(20).for_each(|x| println!("{x}")); }
but why? 😄
Avatar
and since the fizzbuzz is a iterator u can do neat things with it
Avatar
Avatar
Learath2
but why? 😄
cuz i love implementing problems like this this way xd
16:08
instead of the shortes, i go for the most beautiful (according to my judgement) (edited)
16:08
i cant type
Avatar
wtf is Some
Avatar
a variant of the option enum
this 1
16:09
The Option type. See the module level documentation for more.
Avatar
i tried reading that and my brain shut off
Avatar
it indicates whether there is a value or not
16:10
in a safe way
16:10
in cpp u cant totally emulate this
Avatar
because u dont have ADTs in the way rust does
Avatar
ryo teach me rust
⚠️ 1
Avatar
yeah, and u can hack ur way into the inner value without checking
Avatar
my animal brain gets angry whenever i try it myself
16:11
rust = pay raise
Avatar
i dont WANT to try it because every time i do i get useless results the only successful thing i did was make a hello world
Avatar
Avatar
Ryozuki
yeah, and u can hack ur way into the inner value without checking
Well C++ has no "safe" vs "unsafe". If I'm allowed to use all features of Rust I can also get to the inner value without checking using unsafe
Avatar
Avatar
Learath2
Well C++ has no "safe" vs "unsafe". If I'm allowed to use all features of Rust I can also get to the inner value without checking using unsafe
i guess
16:12
but the thing is, in rust u are kinda forced to pattern match
16:12
it feels natural
Avatar
Avatar
Voxel
i tried reading that and my brain shut off
this is just std::optional (edited)
Avatar
in cpp it doesnt
Avatar
Avatar
Ewan
this is just std::optional (edited)
i havent seen that in c++ either
Avatar
pattern matching is truly wonderful
Avatar
Rust matches are hot
Avatar
a good advancement in programming langs
Avatar
Avatar
Voxel
i havent seen that in c++ either
it's just a nullable type
Avatar
Avatar
Voxel
i havent seen that in c++ either
Only like 10 people use it
Avatar
u take the good thing about functional languages
Avatar
We are too used to just using null/0 and calling it a day
16:13
or -1
Avatar
real gangsters optimize the code [[unlikely]] if(x % 15 == 0) { }[[unlikely]] else if(x % 3 == 0) { } etc.
Avatar
Avatar
Learath2
Only like 10 people use it
wdym xd it's really common in modern cpp
16:14
they were looking for it in a few technical interviews i did
16:14
bussin api
Avatar
Avatar
Ewan
wdym xd it's really common in modern cpp
it is well known that anything after C++03 doesn't exist in production codebases
Avatar
Avatar
Ewan
rust = pay raise
bad reason, bad for my values, but good for society
16:14
i will never learn a lang for a payraise
Avatar
Cutting edge is C++11
Avatar
Avatar
Ryozuki
bad reason, bad for my values, but good for society
i am interested in it for what it is
16:15
but also pay raise
Avatar
u just have to put ur mentality in that u cant learn rust like u learn the other langs, as in, oh i can look 5 mins and ill understand how lifetimes work!
Avatar
Avatar
Ryozuki
i will never learn a lang for a payraise
depends on the raise, would you really not learn php for 2k extra a month?
Avatar
it wont work cuz its a new concept
16:15
u need to spend more time
Avatar
Avatar
Ryozuki
u just have to put ur mentality in that u cant learn rust like u learn the other langs, as in, oh i can look 5 mins and ill understand how lifetimes work!
yea
Avatar
Avatar
Learath2
depends on the raise, would you really not learn php for 2k extra a month?
no
Avatar
it fucks my current understanding of almost everything (edited)
Avatar
Avatar
Ewan
it fucks my current understanding of almost everything (edited)
but thats good
Avatar
Avatar
Ryozuki
no
4k extra?
Avatar
learning rust is rly good for cpp devs
Avatar
even fundamental stuff like syntax
16:16
is like
Avatar
it will teach u many mistakes u do
Avatar
specially good in threading
Avatar
can you use rust to make components in ddnet as it is rn
Avatar
Safe Rust guarantees an absence of data races, which are defined as:
>
two or more threads concurrently accessing a location of memory one or more of them is a write one or more of them is unsynchronized
>
A data race has Undefined Behavior, and is therefore impossible to perform in Safe Rust. Data races are mostly prevented through Rust's ownership system: it's impossible to alias a mutable reference, so it's impossible to perform a data race. Interior mutability makes this more complicated, which is largely why we have the Send and Sync traits (see below).
>
However Rust does not prevent general race conditions.
Avatar
Avatar
Ewan
can you use rust to make components in ddnet as it is rn
mh, I'm not sure, you can try, you might need to add some extra hooks
Avatar
Avatar
Learath2
Cutting edge is C++11
boost is cutting edge. C++11 is jsut copy pasta of boost
Avatar
who uses boost in current year
Avatar
Avatar
Chairn
boost is cutting edge. C++11 is jsut copy pasta of boost
True, everyone and their mothers use boost for everything
Avatar
Avatar
Ewan
who uses boost in current year
qbittorrent does
Avatar
Avatar
Ryozuki
u just have to put ur mentality in that u cant learn rust like u learn the other langs, as in, oh i can look 5 mins and ill understand how lifetimes work!
i am a result driven dev and rust is like the complete opposite of that
Avatar
boost::make_game<teeworlds>
Avatar
Avatar
Ryozuki
qbittorrent does
can't imagine what they would need it for
16:18
Qt does everything already xd
Avatar
Avatar
Voxel
i am a result driven dev and rust is like the complete opposite of that
opposite, rust is good cuz ur software quality will usually be better, more resiliant to bugs, etc, which is where most ppl spend time
Avatar
Avatar
Ewan
can't imagine what they would need it for
I love Boost.Intrusive
16:18
One of the few things I like about boost
Avatar
Avatar
Ryozuki
opposite, rust is good cuz ur software quality will usually be better, more resiliant to bugs, etc, which is where most ppl spend time
what happens on integer overflow in rust?
Avatar
im not familiar
16:18
ive never touched boost
Avatar
@Voxel it puts the tax of the work more upfront, instead of paying it later
Avatar
Avatar
Voxel
i am a result driven dev and rust is like the complete opposite of that
but rust community is made for u
16:19
trust me
Avatar
Avatar
Chairn
what happens on integer overflow in rust?
depends on debug or release build, but rust has checkend and saturating int ops
Avatar
u fit perfect
Avatar
Avatar
Ryozuki
opposite, rust is good cuz ur software quality will usually be better, more resiliant to bugs, etc, which is where most ppl spend time
nuh uh the only result i'll get is staring at the rust docs for a week wondering why this one little thing wont compile even though it follows all the rules of the rust docs anyways
Avatar
Avatar
Ryozuki
depends on debug or release build, but rust has checkend and saturating int ops
well, that sounds quite unsafe to have different behavior based on debug or release
Avatar
@Chairn
Avatar
Avatar
Chairn
well, that sounds quite unsafe to have different behavior based on debug or release
its safe*
Avatar
how about zero division error and floating NaN ?
Avatar
i guess he means unintuitive
Avatar
Avatar
Ryozuki
@Voxel it puts the tax of the work more upfront, instead of paying it later
it sounds like rust isnt really built for graphical/ui stuff anyways (edited)
16:21
just cuz it lacks the infrastructure atm doesn’t mean it’s a bad fit
Avatar
Avatar
Voxel
it sounds like rust isnt really built for graphical/ui stuff anyways (edited)
no lang is built for that
16:21
that sentence makes no sense
Avatar
Avatar
Chairn
how about zero division error and floating NaN ?
i need to check, most likely a panic on zero div
Avatar
Avatar
Voxel
nuh uh the only result i'll get is staring at the rust docs for a week wondering why this one little thing wont compile even though it follows all the rules of the rust docs anyways
Pleasing the borrow checker takes some time to learn, but when you do it is much easier make things from scratch in rust thanks to the very rich standard library and cargo ecosystem
Avatar
me using godbolt
Avatar
Avatar
Ryozuki
no lang is built for that
i only ever do like, graphical edits for ddnet since thats what im more comfortable with
Avatar
i press ctrl +s way too often xD
Avatar
Avatar
Jupstar ✪
i press ctrl +s way too often xD
same (is an adobe user)
Avatar
error: this operation will panic at runtime --> src/main.rs:47:13 | 47 | let y = 5 / 0; | ^^^^^ attempt to divide 5_i32 by zero | = note: #[deny(unconditional_panic)] on by default
Avatar
what is a “panic”
Avatar
Avatar
Ryozuki
error: this operation will panic at runtime --> src/main.rs:47:13 | 47 | let y = 5 / 0; | ^^^^^ attempt to divide 5_i32 by zero | = note: #[deny(unconditional_panic)] on by default
I think there is a non-panicking way to do it aswell
Avatar
Avatar
Ewan
what is a “panic”
its well defined
Avatar
same as you uncaught exception ?
Avatar
idk whst it is
16:23
O
Avatar
Avatar
Ewan
what is a “panic”
Xpanic reference @cyberFighter
Avatar
If the main thread panics it will terminate all your threads and end your program with code 101.
16:23
goals
Avatar
Rust has a tiered error-handling scheme:
>
If something might reasonably be absent, Option is used. If something goes wrong and can reasonably be handled, Result is used. If something goes wrong and cannot reasonably be handled, the thread panics. If something catastrophic happens, the program aborts.
Avatar
rust isnt perfect, but there is more stuff making sense than in most languages
Avatar
I would add that for libraries you should keep your "what can be reasonably handled" bar very high, just let your user decide
Avatar
most do that
16:25
in fact
16:25
there is a rust guidelines for good quality libraries
Avatar
Avatar
Learath2
I would add that for libraries you should keep your "what can be reasonably handled" bar very high, just let your user decide
very low, would be more correct there maybe, idk the sentence confuses me now that I've written it out
Avatar
This is a set of recommendations on how to design and present APIs for the Rust programming language.
16:26
i try to follow this always
16:26
its my religion
Avatar
i hate making things from scratch but if i were to do ANYTHING id want to make an easy rendering engine thats as intuitive as scratch's canvas but as blazingly fast as a normal coding language so that when i have stupid ideas in my head i can just, jump in and start making them without having to build up everything just to get a picture on the canvas
Avatar
I was supposed to study control theory, instead I wasted an hour talking about fizzbuzz pepeW
Avatar
Avatar
Learath2
I was supposed to study control theory, instead I wasted an hour talking about fizzbuzz pepeW
and you learned absolutely nothing
Avatar
grahh‼️
Avatar
he learnt rust
Avatar
Avatar
Voxel
i hate making things from scratch but if i were to do ANYTHING id want to make an easy rendering engine thats as intuitive as scratch's canvas but as blazingly fast as a normal coding language so that when i have stupid ideas in my head i can just, jump in and start making them without having to build up everything just to get a picture on the canvas
have you tried p5.js? It's quite fun to mess around with
Avatar
Avatar
Voxel
i hate making things from scratch but if i were to do ANYTHING id want to make an easy rendering engine thats as intuitive as scratch's canvas but as blazingly fast as a normal coding language so that when i have stupid ideas in my head i can just, jump in and start making them without having to build up everything just to get a picture on the canvas
there is one in rust
16:27
Macroquad is a simple and easy to use game library for Rust programming language.
16:28
use macroquad::prelude::*; #[macroquad::main("BasicShapes")] async fn main() { loop { clear_background(RED); draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE); draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, 60.0, GREEN); draw_circle(screen_width() - 30.0, screen_height() - 30.0, 15.0, YELLOW); draw_text("HELLO", 20.0, 20.0, 20.0, DARKGRAY); next_frame().await } }
Avatar
awesome bro
16:28
reminds me of win2d
16:28
the most basic bitch stuff
Avatar
its made after the C library
16:28
i forgot the name
16:28
its the name of the guy
Avatar
imagine being named C
Avatar
which guy
Avatar
raylib
16:29
love that guy
Avatar
raylib is a simple and easy-to-use library to enjoy videogames programming.
16:29
its inspired by this
Avatar
he makes great stuff
16:29
im a fan of his resource system
16:29
though never had to use it
Avatar
i used raylib in the past
16:30
i was a big C fan
Avatar
but then he took a rusty arrow in the knee
16:30
i always just used sdl and worked with images
16:30
i didnt have a need to draw abstract stuff like that
16:31
my c, c++ repos
16:31
xd
16:31
they rly old
Avatar
i preferred cpp pretty much the moment i realized it was different from C in the grand scheme of things (edited)
Avatar
Avatar
Ryozuki
use macroquad::prelude::*; #[macroquad::main("BasicShapes")] async fn main() { loop { clear_background(RED); draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE); draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, 60.0, GREEN); draw_circle(screen_width() - 30.0, screen_height() - 30.0, 15.0, YELLOW); draw_text("HELLO", 20.0, 20.0, 20.0, DARKGRAY); next_frame().await } }
tee_thinking
Avatar
the first code i'd been exposed to never really made a distinction or tried hard to adhere to particular philosophies of one language or the other
16:32
it just did shit
16:33
and shit was done
Avatar
i like how this is made to be for game dev but considering i grew up on a "game creation kids website" and how its capable of fluid animation
16:33
this is gonna be fun when i find out how to compile it
Avatar
i would not expect that to be too performant
Avatar
to me top1 about rust is macros they can hide so much logic and make everything easier
16:33
its rust so
16:33
its perfomant already
16:33
vs making a python game
Avatar
it doesn't matter if you're re-generating everything every frame like a madman
16:34
i mean it does definitely but
Avatar
Learn vulkan from @Jupstar ✪
Avatar
there are optimizations to be made beyond the language level
Avatar
actually in macroquad the perfomance hit will be from ur code and how u design stuff
16:34
since it doesnt do much itself
Avatar
I'll go do some chores around the house so I can feel like I've at least done something today
Avatar
Avatar
Learath2
Learn vulkan from @Jupstar ✪
ok lets start by writing 1000 lines of code you absolutely don't understand
Avatar
in bevy u get lot of perfomance thanks to the already massively paralelized ECS
16:34
i like bevy
Avatar
Avatar
Jupstar ✪
ok lets start by writing 1000 lines of code you absolutely don't understand
Is 1k lines enough to render a triangle? Prayge
16:35
this is what i needed to draw a triangle
16:35
IIRC
Avatar
if u use smth like SDL then yes
16:35
if u do native x11 implementation probs not xd
Avatar
what i used to do to optimize rendering is keep many different layers of framebuffer & draw to them as necessary and then combine them at draw time the cost of alpha blending these at draw time was big, but not bigger than re-generating them would be every frame in a situation where the contents did not change on that layer (edited)
16:35
i have no idea what this strategy is called
16:36
or if it's any good
16:36
but i also worked with sdl so it was pretty high level lol
16:36
never done too much with gl or the like
Avatar
i used opengl
16:36
its quite ez
16:37
but i never rly looked much into ddnet renderer code tbh
16:37
im 2 lazy
16:37
cuz jupstar is there
16:39
xd
Avatar
unrelated but unique usa servers are now up
Avatar
Avatar
Ewan
what i used to do to optimize rendering is keep many different layers of framebuffer & draw to them as necessary and then combine them at draw time the cost of alpha blending these at draw time was big, but not bigger than re-generating them would be every frame in a situation where the contents did not change on that layer (edited)
depends on the complexity of the task ^^ with a stencil buffer u could maybe reduce alpha blending tests or even fragment calculations at all
Avatar
race db is not hooked up, instagib and freeze are not working
16:39
but others are good
Avatar
transparency is hardest thing to optimize well xd
16:39
raytracing best
16:40
no more struggle
16:40
only need to be math genius
16:40
and 4090
Avatar
Avatar
Jupstar ✪
depends on the complexity of the task ^^ with a stencil buffer u could maybe reduce alpha blending tests or even fragment calculations at all
too low level do be of assistance in what i was doing, im afraid
16:40
sdl texture is like the most rudimentary hardware accelerated graphics api you can use in C
16:41
as far as i know
Avatar
i can tell you a funny story
16:41
when ur GPU is not at 100% it's faster to render a big fat black square, than letting the driver clear the memory
Avatar
i tested this like 2 years ago on android and my desktop pc, bcs i used blitting and it was so slow, so i also tried it for clearing framebuffers
16:42
so if in these 2 years the drivers didnt change, gg xd
16:43
mh but on vulkan you can move the clear to the renderpass that's defs smth that doesnt exists in opengl
16:43
should test some day in 5000 years
Avatar
wait so if you render a black square does everything get overwritten or is it still "there"
Avatar
its overwritten
Avatar
Avatar
Cellegen
Click to see attachment 🖼️
@Ryozuki no one can top my simple and small codes
16:48
ngl I just joinked part of the code from chatgpt xd
16:48
"my" simple and small code
Avatar
stable diffusion is amazing
Avatar
Avatar
Voxel
"my" simple and small code
dumbs admire complexity, geniuses admire simplicity, I admire my own code
16:58
gigachad
Avatar
Avatar
louis
stable diffusion is amazing
no it fucking isnt :(
Avatar
i mean its pretty fun for personal use xd
17:01
i think the future of ai is pretty inevitable
Avatar
thats the thing i dont want it to because i can just tell its going to be doing all the fun work for us
17:03
like theres a certain charm in putting effort into something, and having that stripped away feels like the entire thing is worthless
17:03
because anyone else could do the exact same thing in the same amount of short time
17:03
if everyone's special, no one is
Avatar
Avatar
louis
stable diffusion is amazing
it is
Avatar
The ASan/UBSan logs are currently only printed in the CI log when launching the client and server once. Now the logs are also printed when the unit or integration tests fail due to a sanitizer crash. A redundant definition of an environment variable is removed.

Checklist

  • [ ] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test (especially base/) or adde...
Avatar
look at my waifus
Avatar
@Ryozuki i think i ahve better waifus
Avatar
Avatar
Voxel
like theres a certain charm in putting effort into something, and having that stripped away feels like the entire thing is worthless
yeah thats pretty true
Avatar
impossible
Avatar
esp for digital art, it will change the landscape for the worse for artists
17:07
@Ryozuki im dling like 20 gb of checkpoint models rn xd
Avatar
Avatar
louis
@Ryozuki i think i ahve better waifus
i doubt it
Avatar
Avatar
Cellegen
@Ryozuki no one can top my simple and small codes
for i in range(1, 101): print(i if (i % 3 and i % 5) else ("Fizz" if not i % 3 else "") + ("Buzz" if not i % 5 else "")) gigachad
Avatar
Avatar
ChillerDragon
da
oh yes
Avatar
Avatar
Ravie
for i in range(1, 101): print(i if (i % 3 and i % 5) else ("Fizz" if not i % 3 else "") + ("Buzz" if not i % 5 else "")) gigachad
can a newbie read it?
17:37
I guess it can, good YEP (edited)
Avatar
with this http
Avatar
i mean thats no sync how can i do the request and wait the response mhhh
Avatar
ofc you can't, that api is asynchronous, you need to make your request and every tick check if it succeeded
Avatar
Trying to play the map Cerberus. says uploading to gpu, then, Too weak connection (not acked for 5 seconds), tried to join on different servers, same message, pls help
Avatar
Avatar
Ryozuki
#![forbid(unsafe_code)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)] use std::{fmt::Display, println, write}; #[derive(Debug, Clone, PartialEq, Eq, Default, Hash)] struct FizzBuzzGenerator(usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum FizzBuzzPutput { Fizz, Buzz, FizzBuzz, Number(usize), } impl Display for FizzBuzzPutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Fizz => write!(f, "Fizz"), Self::Buzz => write!(f, "Buzz"), Self::FizzBuzz => write!(f, "FizzBuzz"), Self::Number(x) => write!(f, "{x}"), } } } impl Iterator for FizzBuzzGenerator { type Item = FizzBuzzPutput; fn next(&mut self) -> Option<Self::Item> { self.0 += 1; let n5 = self.0 % 5 == 0; let n3 = self.0 % 3 == 0; if n5 && n3 { Some(FizzBuzzPutput::FizzBuzz) } else if n3 { Some(FizzBuzzPutput::Fizz) } else if n5 { Some(FizzBuzzPutput::Buzz) } else { Some(FizzBuzzPutput::Number(self.0)) } } } fn main() { let epic_fizz_buzz = FizzBuzzGenerator::default(); epic_fizz_buzz.take(20).for_each(|x| println!("{x}")); }
unclear why you use an architecture-specific integer length. should probably use i32 instead
Avatar
doesn't matter here
Avatar
Avatar
Ryozuki
#![forbid(unsafe_code)] #![deny(warnings)] #![deny(clippy::nursery)] #![deny(clippy::pedantic)] #![deny(clippy::all)] use std::{fmt::Display, println, write}; #[derive(Debug, Clone, PartialEq, Eq, Default, Hash)] struct FizzBuzzGenerator(usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum FizzBuzzPutput { Fizz, Buzz, FizzBuzz, Number(usize), } impl Display for FizzBuzzPutput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Fizz => write!(f, "Fizz"), Self::Buzz => write!(f, "Buzz"), Self::FizzBuzz => write!(f, "FizzBuzz"), Self::Number(x) => write!(f, "{x}"), } } } impl Iterator for FizzBuzzGenerator { type Item = FizzBuzzPutput; fn next(&mut self) -> Option<Self::Item> { self.0 += 1; let n5 = self.0 % 5 == 0; let n3 = self.0 % 3 == 0; if n5 && n3 { Some(FizzBuzzPutput::FizzBuzz) } else if n3 { Some(FizzBuzzPutput::Fizz) } else if n5 { Some(FizzBuzzPutput::Buzz) } else { Some(FizzBuzzPutput::Number(self.0)) } } } fn main() { let epic_fizz_buzz = FizzBuzzGenerator::default(); epic_fizz_buzz.take(20).for_each(|x| println!("{x}")); }
Bro made 2 classes and enum for a fizzbuzz kek
Avatar
chillerdragon BOT 2023-05-13 20:52:29Z
xd (@Anime.pdf)
Bro made 2 classes and enum for a fizzbuzz [:kek: https://mau.lu/fnotcs ] (@Ryozuki)
Avatar
It’s That Blog Post. The release one, where we round up all the last of the features approved since the last time I blogged. If you’re
Avatar
Turk servers have no default location in server browser
21:36
21:36
looks weird
Avatar
Avatar
Learath2
ofc you can't, that api is asynchronous, you need to make your request and every tick check if it succeeded
exactly, boring crying
Avatar
Avatar
Jupstar ✪
Turk servers have no default location in server browser
@heinrich5991 I keep forgetting how to override that 😄
Avatar
ec965d7 Show ASan/UBSan logs in CI also for unit and integration tests - Robyt3 bf27dd6 Merge #6584 - bors[bot]
Avatar
#include <game/mapitems.h> #include <iostream> #include <game/client/gameclient.h> #include "engine/external/json-parser/json.h" #include "engine/shared/json.h" #include <curl/curl.h> error because gameclient and curl are in conflit or something like, can i use http library in the project to do a Sync request?
Avatar
you can't really do a sync request from that code
23:26
it'd mean the client freezes until then
Exported 815 message(s)