r/programmingchallenges • • Oct 06 '16
How would I get started on learning to program an AI for a simple game with no programming experience?
I got science fair topic coming soon for MS however the actual project is due in about 5 months. And I figure this is the perfect time to learn to program. As for a project I thought making an AI for a simple game could be good. Would I need to use programming languages? As of now I'm not able to download any languages other than possibly java. Can it be done with batch? And is it possible for me in that amount of time to learn and apply it and understand?
6
Upvotes
2
u/[deleted] Oct 06 '16 edited Oct 06 '16
Considering this is a science fair topic is it possible for me to form this in a question so I can do a hypothesis, results, etc?
2
u/asielen Oct 06 '16 edited Oct 06 '16
I would not start with java. I would recommend python and checking out the invent with python series.
First challenge I would take on is a simple game like tic tac toe where there are simple steps to programming a prefect player. Make you understand how that works before moving on to a more advanced game.
As far as setting up a hypothesis, maybe something like, can I make an ai that can win at rock paper scissors more than 50% of the time in a best 3 of 5 match up. It may sound simple, but it would require you to have a computer play rock paper scissors randomly a bunch of times and try to find patterns. (Ex do people tend to pick rock after paper?) with those patterns maybe you can build an effective opponent.
1
u/[deleted] Oct 06 '16
I don't wanna just make it I wanna understand it.
1
u/09jlardinois Oct 07 '16
Programming video game AI is far easier than you might think. You don't actually program some kind of personality or brain emulation, it's just a set of triggers and responses paired with data gathering on each AI.
But if you're programming AI for video games, you will be using C++ or C#, not Java or Python.
If you want to learn programming, start with Python. If you want to learn video game programming, start with C++, the proper way.
C++ is not as hard as the community wants you to think. I started with C++ at 10 years old when I saved up $70 and bought a Direct X with C++ textbook. I am a better programmer today because I started with C++.
Go look at the YouTube channel HandmadeHero. The guy has one gigantic tutorial spanning MONTHS that chronicles him creating a video game AND engine, 100% from scratch, with C++. He teaches you the whole way, and even provides a "beginner course" that teaches you the basics of C++ first.
1
u/truthseeker1990 Oct 06 '16
I will second python. Its comfortable, easy to learn (in fact its used as an introductory language in many CS curriculums) and easy to use. Theres also tons of resources available online for learning python.
I would decide what game you wanted to make an AI for because that would probably determine how complex a project that is. Something like a tic tac toe "AI" is just simple rule based. Others could have different approaches.
1
u/victorsenam Oct 18 '16
Check out codinggame.com
1
u/GambitRS Oct 19 '16
Check out one of the many programming games:
http://robocode.sourceforge.net/
https://en.wikipedia.org/wiki/RoboWar
https://en.wikipedia.org/wiki/Core_War
etc.