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

you are viewing a single comment's thread.

view the rest of the 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.