Game dev. The art of writing games. It's a little bit of a childhood dream of mine to write a game. A game, which is enjoyed by many people. A game, which reflects the world of my dreams. I can do whatever I want, and show other people what I think a...

Markdown supported · ⌘↵ to post
Really thorough tutorial! A couple of points, though:
Math.floor( Math.random() * 100 ) + 0 where 100 is the upper bound and 0 is the lower bound.setTimeout for example, in the browser) to do async tasks. However, this claim is wrong. The reason why we have these async functions is because JavaScript is sync and some tasks are blocking. while( true ) for nothing else but readability. ' in the line First of all, what\'s your name?, you can use double-quotes which allow single quotes to co-exist in the string: "First of all, what's your name?"elseif block is much better than isolated conditions. There is a puzzle game, and I want to recommend you https://quordlewordle.com/,В this game simple gameplay, you need to guess four simultaneous words in nine tries, nothing difficult, the game will help you relax from everyday life, it helps me to relax, can help you too.
Stumbled upon a fairly simple game, but it still pulled me in, I play https://weavergame.org/ and can not tear myself away, sometimes I forget about the business at home, but the game just pulled me in, I was not interested in other games, I do not know why so, but I play only this game.
I'd suggest trying to avoid using while(true) and break -- it reeks of spaghetti code jump-style.
You could just do-while there. As someone weaned on assembly and pascal, the do/while (what Pascal calls repeat/until, and in ASM is the cornerstone of all efficient loops) structure is just closer to how the hardware works and feels more intuitive the lower-level you go. As a construct, while (true) is just a wasted boolean comparison in the loop.
do { myConsole.print('Take a guess: '); guess = parseInt(await myConsole.readln()); myConsole.println(guess.toString()); myConsole.println( guess > number ? 'My number is smaller!' : ( guess < number ? 'My number is greater!' : `Congratulations, ${playerName}! My random number is ${number}!` ) ); } while (guess !== number);Also, ternary operators are your friend. If every single result is just going to println, you only need one println.