"I've implemented a lot of small games in the past but never actually Snake, which is quite poggers."
@bassguitarbill3 жыл бұрын
Really really good episode, it's very fun to see this language evolve over time.
@burnax98173 жыл бұрын
he made an entire fucking programming language to make snake game, am impressed
@remrevo39442 жыл бұрын
1:11:06 In rust there is something called a never type, which signals that no point after it will ever be reached. (It's used for example in case of infinite loops, or also for the exit syscall. I think something like that might be possible to use for porth too.
@davidkatz10173 жыл бұрын
For let bindings where you want some of them to be returned to the stack automatically, you could use the same syntax as in `proc`. Like: ``` 1 2 3 4 let a b c d -- a b in a print b print c print d print end print print // 123421 ```
@denoww92613 жыл бұрын
I like this idea
@koktszfung3 жыл бұрын
And you can do let a b c d -- b a in 😱
@chivvii3 жыл бұрын
and maybe you do this: let a b c d -- in ... end as a shorthand for leave all the bindings on the stack.
@minamagdy41263 жыл бұрын
For readability, no. Th a should be how to remove all elements from the stack. I suggest this for let all stay: let a b c in # # end Basically have the default be peek, and bikeshedder operator denote dump all and leave this in the stack.
@minamagdy41263 жыл бұрын
Better yet: have syntax like th I work as suggested here for custom stack manipulation: let a b c -- b c a end This is an example of rewriting rot in terms of my modification of let bindings.
@whythosenames3 жыл бұрын
you could use take as a divider between what you want to peek and take, so at 21:10 you would have let y x take px py in ... end if you just want to peek it would be let a b in ... end and if you want to take it would be let take a b in ... end
@kaksisve40123 жыл бұрын
That formula can be suitable for alignment. It tries to align `s` bytes at boundary `w`, or at smaller boundaries. a(w, s) = when s % w == 0 -> s s > w -> s + w - s % w s < w -> a(w / 2, s)
@foxoninetails_3 жыл бұрын
You don't actually need signed mod to handle wrapping! The following would wrap your coordinates properly without ever touching negative numbers, as long as your board isn't hypermassive. let x y in x COLS + COLS % y ROWS + ROWS % end The reason this works is that mod is essentially a wrapping operation in and of itself; if the dividend is greater than the divisor, it wraps the dividend so that it's in range. By adding the divisor to the dividend before doing mod, you offset the operation so that you never have to deal with negatives, without changing the result. This method does limit your board size to half of the maximum integer, but that's an excessively impractical size anyway.
@emilioschmidt21063 жыл бұрын
1:15:25 I've always wondered *why* moding produces negatives (in C) Why does (-4)%3 equal -1 and not 2, like in python. What is the advantage of that?
@hanqnero2 жыл бұрын
As I know Python's mod operation is mathematicaly correct while in many other languages they just slap minus to the result if there are negative operands, because historicaly in Intel CPUs the modulo operation was implemented that way.
@SaHaRaSquad2 жыл бұрын
These are two different operations: modulo and remainder. Remainder produces negative numbers if the result of the division is negative (for example -10/4). The function of the % operator is not consistent between languages. Some languages have both variants, usually named "mod" and "rem" or something along those lines.
@dwightk.schrute86963 жыл бұрын
59:50 JavaScript programmers have destructuring and spread operators mr. zozing
@rogo73303 жыл бұрын
58:55 - when I was writing a selfcorrected clock bar I experimented with usleep at first (and it was an awful laggy garbage), then I tried with nanosleep. When I passed one minute to the tv_nsec (1 second * 60) my laptop almost melted down and shit around. Don't know why is that. When I passed one minute to tv_sec all was right.
@mbarrio3 жыл бұрын
I learn so much by your mistakes, analysis and explanation. Thanks.
@Pi7on3 жыл бұрын
I really like the peek and take idea
@keldwikchaldain95452 жыл бұрын
I think I would've made the board a bit different: make every cell an int, have a length stored, every tick store the length in the player's current cell, decrement all the cells, and then print. Every cell that's >0 is part of the snake. If you eat an apple in a given tick, just don't decrement the cells.
@haxidenti60012 жыл бұрын
Would be fun to write lua interpreter in porth :)
@civilizedgangster80243 жыл бұрын
This felt like a fever dream
@ludfde3 жыл бұрын
128 bit division for the win. :P
@niikurasu28553 жыл бұрын
Thank you for uploading the streams :)
@ludoviclagouardette70202 жыл бұрын
May the porth be with you
@stomah98323 жыл бұрын
print the character twice for squareish pixels
@tusharmaurya16683 жыл бұрын
32:03 that was funny 🤣🤣
@satsuki-rin3 жыл бұрын
it would be cool to have a variant of the let binding that automatically does the @ operation on whatever data beforehand and does the ! operation afterwords as i could see that being something someone would want to do commonly
@qwerty123443wifi3 жыл бұрын
Why not use git LFS for the assemblies?
@bigmistqke3 жыл бұрын
I m organizing an exhibition w my friends and we r gonna call it 'the bikeshed will be red'
@kedusyared65893 жыл бұрын
wait idk how to implement this. Let me check the docs. Oh wait I created this language. 😭
@astroblade37823 жыл бұрын
Hello! Im the person who failed to explain COQ; sorry about that. Nice job on the snake!
@0xjoemama3 жыл бұрын
What if let bindings captured using peek or take only if you specify it? For example `let peek x peek y px py in ...`?
@kaksisve40123 жыл бұрын
Then syntax will be too noisy.
@emilioschmidt21063 жыл бұрын
Is there a way to represent fractional numbers (like floats) in porth?
Did you based your language on C or C++? It looks a little bit similar
@devhypercoder25222 жыл бұрын
If you read the description of the language, it's like the stack based programming language forth Initially made in python, now is self hosted (written in itself)
@levoca-92962 жыл бұрын
I find it very different than C++ or C syntax and in the way that it works
@NeonLightRays2 жыл бұрын
its directly inspired by forth
@MegaMrUnbelievable2 жыл бұрын
@@NeonLightRays Thanks!
@rogo73303 жыл бұрын
Keep bootstrap folder in a torrent :D
@smooll_d3 жыл бұрын
Why is it called reverse Polish notation? Can it kurwa? can it Grzegorz Brzęczyszczykiewicz? What's going on?
@smooll_d3 жыл бұрын
@Mekelaina oh so it's literally Polish. That's so fucking cool!
@frechjo3 жыл бұрын
It can sing Gdzie jest biały węgorz backwards.
@emilioschmidt21063 жыл бұрын
Who's Joe?
@spacewad8745 Жыл бұрын
joe mama
@Khusyasy3 жыл бұрын
hello hello hello
@desertfish743 жыл бұрын
How about that.
@Bobbias3 жыл бұрын
Dammit, you got your p all over the stack!
@thelambdafunction3 жыл бұрын
At this point, this is so much not Forth, that calling it Porth is quite.... Egh