Hello! I just finished making this game, it was my first ever experience building and running a program! Your video was super helpful and I learned a lot, not just about Haskell but also using Emacs. Thank you very much for this tutorial! :)
Did you do this in haskell? Amazing!! I made a small hangman game in haskell recently. And OMG I loved it. Haskell makes it so that i can just take one look at a function and the function will speak for itself about what it's doing. Next try to build a snake game with haskell hehe.
@@samuraijosh1595 Yes I did :) it was a really good experience with programming in general. I also did the Hangman game hehe. Right now I'm trying to develop a personal application through Haskell, wish me luck! P.S. I might try the snake in the future :)
Juggling with indices is often tedious and might sometimes lead to off by one errors. If the board was a static 3x3, I would define a [[Cell]] containing all rows (horizontal, vertical, diagonal) and use functions like ‘all’ and ‘any’ to determine the winning and endgame states. For dynamic size boards this structure can be calculated by (assuming board :: [[Cell]]): let tBoard = transpose board in diagonal board : diagonal tBoard : (board ++ tBoard) where diagnonal ((x:_):rest)) = x : diagonal (map (drop 1) rest), diagonal _ = []. Again, if it was a static 3x3 board, I would just list all “rows” once.
Чувак, от души спасибо за видео! Пишем с подругой сейчас игру "Морской бой" на haskell, и твое видео нам очень помогло. Ждем с нетерпением ждем следующих роликов! Dude, thanks for the video! We are now writing a game "Sea Battle" on haskell with a friend, and your video helped us a lot. We are looking forward to the next videos!
Yep, that's true. With gloss we don't have to organize the event loop as we did in the procedural example. But that actually enables us with making ~99% of the code pure functional. Notice how there is no a single `do` in the entire code base and the only place we use the `IO` type is in the `main` function. :)
I would calculate the state running/ended, which player won or if it is a tie and whose player‘s move it is (assuming x always starts) from the board. This takes some (in this case little) computational power and trades it for more guaranteed consistency of the data structure.
I think Persistent Data Structures that solves that issue. But yeah, Haskell programs are not as fast as C or other low-level languages, but it gets pretty close.
At 13:10 the procedural and functional results don't look the same: the functional image has a border showing at the bottom and right side of the screen.
Hello! I just finished making this game, it was my first ever experience building and running a program! Your video was super helpful and I learned a lot, not just about Haskell but also using Emacs. Thank you very much for this tutorial! :)
Did you do this in haskell? Amazing!! I made a small hangman game in haskell recently. And OMG I loved it. Haskell makes it so that i can just take one look at a function and the function will speak for itself about what it's doing.
Next try to build a snake game with haskell hehe.
@@samuraijosh1595 Yes I did :) it was a really good experience with programming in general. I also did the Hangman game hehe. Right now I'm trying to develop a personal application through Haskell, wish me luck! P.S. I might try the snake in the future :)
I found this very helpful for understanding functional programming.
Juggling with indices is often tedious and might sometimes lead to off by one errors. If the board was a static 3x3, I would define a [[Cell]] containing all rows (horizontal, vertical, diagonal) and use functions like ‘all’ and ‘any’ to determine the winning and endgame states. For dynamic size boards this structure can be calculated by (assuming board :: [[Cell]]): let tBoard = transpose board in diagonal board : diagonal tBoard : (board ++ tBoard) where diagnonal ((x:_):rest)) = x : diagonal (map (drop 1) rest), diagonal _ = []. Again, if it was a static 3x3 board, I would just list all “rows” once.
Чувак, от души спасибо за видео! Пишем с подругой сейчас игру "Морской бой" на haskell, и твое видео нам очень помогло. Ждем с нетерпением ждем следующих роликов!
Dude, thanks for the video! We are now writing a game "Sea Battle" on haskell with a friend, and your video helped us a lot. We are looking forward to the next videos!
The logic in the playerwon function could be made a lot easier by pattern matching the 3x3 board.
Sure! Feel free to submit a pull request with a fix: github.com/tsoding/profun :)
Fuck man, this is all i needed, not some boring tutorial stating the basics, this
I feel like Gloss is doing a bit more heavy lifting compared to SDL in the C version.
Yep, that's true. With gloss we don't have to organize the event loop as we did in the procedural example. But that actually enables us with making ~99% of the code pure functional. Notice how there is no a single `do` in the entire code base and the only place we use the `IO` type is in the `main` function. :)
Finally :) Just in for this great functional stuff !
Btw. would love to see Boids in Haskell (with Gloss :)).
I would calculate the state running/ended, which player won or if it is a tie and whose player‘s move it is (assuming x always starts) from the board. This takes some (in this case little) computational power and trades it for more guaranteed consistency of the data structure.
12:10 BIG LOL here 😂😂😂
Ok. but what about performance? if immutable structs copies data in memory after each call, how to draw assassin's creed in 60 fps?)
I think Persistent Data Structures that solves that issue. But yeah, Haskell programs are not as fast as C or other low-level languages, but it gets pretty close.
i just finished learning python.... this is like 20 steps above my paygrade
Excuse me. What is the double diagonal meaning at 11:21 ?
could you write an article talking the differences about each one of them and what you think. i get bored too easy by watching videos
help-me-im-trapped-in-the-basement
This was amazing I loved it!
Я ошибаюсь, или правильно чувствую русский акцент (хоть и не сильный)?
how can i get the external modules to be added to the haskell file?
This really cool I wanna know how big of a game can u make on Haskell? Like COD and fortnite?
Not sure about COD, but Quake 3 is quite possible lambdacube3d.com/
@@Tsoding This lambdacube3d website and project is awesome. Such a shame this is not used anywhere. :-(
@@Tsoding _Oh, why did I, Russian guy, go to the Net…_
Thank you 😍, you help me a lot
so its better to follow haskell or is it good to c one
Thanks for this video! It help me a lot 👌
At 13:10 the procedural and functional results don't look the same: the functional image has a border showing at the bottom and right side of the screen.
Where tf is part 1 lol
excellent video. well done
Please....web scraping in Haskell....Gracias...gracias
А где сравнение? Пустое видео.
muy bueno , gracias¡¡¡
hack in Haskell every day.
Beautiful
fine. Now heavily parallelize it to 12 cores :))
how do I run this on Mac?
Sir, we are waiting for part 3, object-oriented version. Great job
Cabal is not installing
Stack is better
very fast
Nope, still don't understand Haskell. Much prefer the ML dialects. ;)
Dude, same
Would be great see an Object Oriented implementation.
but then REAL OOP - as in CLOS or Smalltalk :)
Your skill is amazing but you have a bad taste for environment colors.