JavaScript Snake Game Tutorial Using Functional Programming

preview_player
Показать описание
Build a Snake Game in JavaScript using Functional Programming concepts. No libraries are used in this JavaScript tutorial.

Created by Christopher Okhravi.

--

Рекомендации по теме
Комментарии
Автор

Me: trying to learn javascript
Ad: "Pythons where its at"

athebot
Автор

"The interwebs."
He said "The Interwebs."
9/10 video, needs more snakes

jef_f
Автор

That is a great tutorial! I work as scala developer and I'm currently learning elm for fun, so I'm familiar with FP.
You really have a talent creating readable code imho. I was wondering all the time how you would have implemented the nextSnake function and was expecting some complicated mapping over accumulated moves or whatever. But your "remove the tail and append a new head" approach is super elegant. I haven't thought about the problem enough to come up with this elegant solution.

I'll try to reimplement your solution with elm if I have time.

flwi
Автор

You are a really great speaker! Have you spoken at any conferences?

gunhound
Автор

This exercise was amazing, i learned functional programming basics while watching!

marlonlom
Автор

I really liked this, useful to see the functional programming concepts integrated with 2 different UIs.

I would love to see him again do an application with backend persistence.

jhnsntmthy
Автор

boss level lecture
better than my versity teacher

engineermahbub
Автор

You could make millions marketing Red Bull or Coffee:-)

craigwarren
Автор

Great!!! Thanks for including some conceptual ideas, they make programing so much more understandable, useful and enjoyable!

jamieheiney
Автор

Very well explained tutorial. Why do you use multiple arrows for multiple input arguments for function? like p1 => p2 => and not (p1, p2) => ?


Edit: I understand currying now!

NikhilYekhe
Автор

In keeping with the immutability concept, I feel that nextSnake should return a new array of positions rather than appending and dropping elements. It also makes it much more readable imo. Something like:

```
willEat(state)
? [...state.snake, nextHead(state)]
: [...dropLast(state.snake), nextHead(state)]
```

imadetheuniversefun
Автор

Pretty tough way, actually! Great stuff, awesome energy, dude!

PaulStoppable
Автор

Amazing video for someone who is new to game logic. Thank you, Chris!

coolumar
Автор

I'm interested in learning more about functional programming.
Are there any performance implications of using functional programming for games?

samdavepollard
Автор

great, very nice thx
one comment:
IMHO you rnd function is not "totally" correct
I mean, it works for you, because you passing min 0; but yo should subtract min from max
and also it will never put apple to last row/column, because max is exclusive and you passing count-1; you should pass count or add 1
Math.floor(Math.random() * (max - min + 1)) + min;

rastislavsvoboda
Автор

This guy run a great YouTube channel. He is able to elucidate difficult stuff.

deylenergy
Автор

I ve seen Chris coding walks and this is great too

cepi
Автор

super explanation of basic snake game

Sylwester
Автор

Thumbs up for the Slavoj Zizek of programming! 💪

bghead
Автор

Watching this on 1.5x is keeping a smile on my face

stefandili