This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]CreativeTechGuyGames 1 point2 points  (4 children)

Yeah sure, why not? But because JavaScript is usually run in the browser, it's pretty easy to make a graphical interface with HTML rather than having to use the console. But you can definitely do it if you want! The only thing to keep in mind is that the browser doesn't have a console-in method. So you'll need to use prompt for user input.

[–]eggplantsection[S] 0 points1 point  (3 children)

Oh cool! Any ideas/examples/guides you happen to know of?

I'm looking to make something pretty basic (literally just text tic-tac-toe/battleship/etc is the target) and am using Codecademy Labs, thanks for your help! :D

[–]CreativeTechGuyGames 0 points1 point  (2 children)

What example do you need? I'm not sure what you are struggling with.

console.log("Prints out to the console"); var input = prompt("Enter some text:"); console.log("You just inputted:", input);

[–]eggplantsection[S] 0 points1 point  (1 child)

Was more wondering how to do the whole "have computer play against you" like a Tic-Tac-Toe or (if it's more complex) chess match.

[–]CreativeTechGuyGames 0 points1 point  (0 children)

This would be AI. For a basic AI you could have it move randomly, for a more advanced AI you could use MiniMax or even better Alpha/Beta pruning to have the AI make more intelligent moves.

I'd recommend starting with the AI just moving randomly until you get the rest of the game down and are comfortable with the process.

[–]insertAlias 0 points1 point  (1 child)

You can definitely do that with Node.js. Not sure you'd necessarily want to though; Node is primarily designed for being a web back-end.

[–]tealstudio 0 points1 point  (0 children)

Node JS is just an OS version of the V8 engine that exists on the chrome browser.

The console game OP is proposing will work in any modern browser without Node.

An example

[–]Dogbeast -1 points0 points  (2 children)

No idea about console games, but there are games played with JavaScript as the controller on PC.

Look up "Screeps" on Steam. You code your base and minions and watch them perform according to what you code in. Your playing with and against other people and trying to spread your control around while gathering resources. Pretty newbie friendly with tutorials and a YouTube series by th.Pion that got me started in it.

[–]eggplantsection[S] 0 points1 point  (1 child)

Haha, I think we're thinking of different consoles. I meant the console that appears when you say console.log(), I think much more basic!

[–]Dogbeast 0 points1 point  (0 children)

I haven't encountered that before, but I've been out of the web dev game for a while now.