Author |
Topic: Language learning (Read 2936 times) |
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Language learning
« on: Jul 25th, 2008, 10:36am » |
Quote Modify
|
Im very interested in Java and C++ and the prospect of making my own bot but because im still in High School, i cant learn one of these languages in a class and i was hoping that someone could tell me a couple of things... Do you need expensive software to get started? is there any internet courses/instructions? and how long would it take to be proficient?
|
|
IP Logged |
|
|
|
Fritzlein
Forum Guru
Arimaa player #706
Gender:
Posts: 5928
|
|
Re: Language learning
« Reply #1 on: Jul 25th, 2008, 11:37am » |
Quote Modify
|
Ho, ho! You shouldn't ask programmers this question. It is like asking which religion of church you should attend: at first people will answer you, and then the people who answer you will go to war with each other. My first answer is that you should use Python. It's free (in more than one sense) and very easy to get started. The Python Web site has the free downloads you need to get started, and a free tutorial. Your code will not run as fast as C++ code, but that does not matter. Your time to write the program is more important than time it takes the program to run. Python is a good first language, but also lots of professionals use it so it isn't wasted effort by any means. Check out this blog of Singapore high school students who are going to make an Arimaa bot, and it sounds like they will use Python. My second answer is that it doesn't matter what language you use. The hard thing to learn is the algorithms. Read up on how bots think for six months first. If you really understand alpha-beta, if you understand hash tables, if you understand null-move pruning, etc., you will be able to code it in any language. Start reading and thinking first and choose the language later. It takes years to be a proficient programmer, but that has little to do with the language, and a lot to do with modes of thinking. My third answer is that I am not a programmer, so you can ignore my first two answers.
|
« Last Edit: Jul 25th, 2008, 11:42am by Fritzlein » |
IP Logged |
|
|
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Re: Language learning
« Reply #2 on: Jul 25th, 2008, 12:43pm » |
Quote Modify
|
thank you, very helpful
|
|
IP Logged |
|
|
|
nbarriga
Forum Guru
Almost retired Bot Developer
Gender:
Posts: 119
|
|
Re: Language learning
« Reply #3 on: Jul 25th, 2008, 1:29pm » |
Quote Modify
|
I agree with the above suggestion on learning python as a first language. It will take you far less time to get to the point where you can actually write usefull code(instead of just small programs as learning exercise). On the other hand, there are sample bots in Java and C, which you could start modifying instead of writing your program from scratch, as you will need to do if you choose python. Disclaimer: I program for a living, and I use C++, Java and Python at work, so I think I am a somewhat impartial judge(even though C++ rules!!!)
|
|
IP Logged |
|
|
|
Janzert
Forum Guru
Arimaa player #247
Gender:
Posts: 1016
|
|
Re: Language learning
« Reply #4 on: Jul 25th, 2008, 4:54pm » |
Quote Modify
|
As usual Fritzlein's remarks are pretty much spot on. The one thing I might caution though is diving into the game playing algorithms too quickly might be fairly confusing until you learn some of the basic concepts of programming. Also I would recommend that once you are even semi-proficient in your first language (say maybe around the time you could write your own "Conway's game of life" program) you should go ahead and dive into another language. I think learning the second language really helps separate in your mind what the underlying concepts of programming are and what happen to just be quirks of the first language. Janzert
|
|
IP Logged |
|
|
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Re: Language learning
« Reply #5 on: Jul 26th, 2008, 11:49am » |
Quote Modify
|
sounds like a good idea to switch, then i can use the already made bot packages to understand better. Is Java or C++ downloadable and learnable through the internet as well or do you need to buy anything?
|
|
IP Logged |
|
|
|
nbarriga
Forum Guru
Almost retired Bot Developer
Gender:
Posts: 119
|
|
Re: Language learning
« Reply #6 on: Jul 27th, 2008, 9:17am » |
Quote Modify
|
Both are free. You can download a java compiler from SUN's website java.sun.com and g++ is a great C++ compiler, also free. I don't know where to find the windows version though.
|
|
IP Logged |
|
|
|
arimaa_master
Forum Guru
Arimaa player #2010
Gender:
Posts: 358
|
|
Re: Language learning
« Reply #7 on: Jul 27th, 2008, 10:07am » |
Quote Modify
|
For free C++ interface and compiler under Windows "Dev-C++" seems to be good choice.
|
|
IP Logged |
|
|
|
Janzert
Forum Guru
Arimaa player #247
Gender:
Posts: 1016
|
|
Re: Language learning
« Reply #8 on: Jul 27th, 2008, 11:27am » |
Quote Modify
|
While I'm not a great fan of microsoft, they do now have free versions of visual studio C++ for download and will probably have the most books and tutorials written specifically for. Janzert
|
|
IP Logged |
|
|
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Re: Language learning
« Reply #9 on: Jul 27th, 2008, 6:12pm » |
Quote Modify
|
thank you guys, im going to get started reading up on this stuff and maybe ill be smart enough in a couple months to try a bot
|
|
IP Logged |
|
|
|
99of9
Forum Guru
Gnobby's creator (player #314)
Gender:
Posts: 1413
|
|
Re: Language learning
« Reply #10 on: Jul 27th, 2008, 8:21pm » |
Quote Modify
|
on Jul 27th, 2008, 10:07am, arimaa_master wrote:For free C++ interface and compiler under Windows "Dev-C++" seems to be good choice. |
| I coincidentally just tried this last week, and am planning to use it to teach a computer simulation course. So, yes, I think it's a good choice. We will just be using C not C++... so I can't really comment on that aspect of it.
|
« Last Edit: Jul 27th, 2008, 8:22pm by 99of9 » |
IP Logged |
|
|
|
BlackKnight
Forum Guru
Arimaa player #695
Gender:
Posts: 98
|
|
Re: Language learning
« Reply #11 on: Jul 29th, 2008, 9:39am » |
Quote Modify
|
I also used Dev-C++ before but I switched to Eclipse (for Java and C++) over a year ago. (For Linux and Windows.)
|
|
IP Logged |
|
|
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Re: Language learning
« Reply #12 on: Aug 10th, 2008, 4:04am » |
Quote Modify
|
ok, i started python...but i have encountered a problem...im doing the tutorial and its requesting that i assign raw_input () to a variable but whenever press enter, whatever is inside of the brackets is printed out instead of waiting for me to add more information multiplier = input("Which multiplier do you want? Pick a number ") for j in range(1,13): print "%d x %d = %d" % (j, multiplier, j * multiplier) it refuses to recognize what the variable "multiplier" stands for so i cant go any further any help?
|
|
IP Logged |
|
|
|
Janzert
Forum Guru
Arimaa player #247
Gender:
Posts: 1016
|
|
Re: Language learning
« Reply #13 on: Aug 10th, 2008, 5:01am » |
Quote Modify
|
It sounds like you are going through the tutorial by executing it at the interactive interpreter. This is fine and a great way to test things out quickly. It does mean that each line will be executed as you enter them though. So python is asking for you input as soon as you hit enter. It will then assign the number you type in to the variable and you can continue entering in the next line. Here's a copy of a local session I just did with the code you pasted above: Code: C:\>python Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> multiplier = input("Which multiplier do you want? Pick a number ") Which multiplier do you want? Pick a number 3 >>> for j in range(1,13): ... print "%d x %d = %d" % (j, multiplier, j * multiplier) ... 1 x 3 = 3 2 x 3 = 6 3 x 3 = 9 4 x 3 = 12 5 x 3 = 15 6 x 3 = 18 7 x 3 = 21 8 x 3 = 24 9 x 3 = 27 10 x 3 = 30 11 x 3 = 33 12 x 3 = 36 >>> |
| If you want to enter a program all at once before running it you'll need to write it in a text editor and save it in a file for python to run. Notepad comes with windows but is a fairly limited editor and you'll probably want to move on to something else fairly quickly. Scite is a fairly easy one to start using and much better than Notepad. You'll find that choice of editor is a much more contentious issue than programming language among programmers though. Personally I use Vim but it's probably not the easiest to start with (lots of command shortcuts that aren't easily discovered). Emacs is also another popular choice, but I'll refrain from expressing any opinions on it as I don't want to start an editor war here. Python programs are typically saved in files that end with a ".py" extension. So you could save your code in something like multiplier.py then run it with the command "python multiplier.py". Janzert P.S. Note that the code you pasted and I used above use input() instead of the raw_input() you mentioned in your message. input() will interpret the text entered, in this case resulting in a number being placed in the multiplier variable. raw_input() always returns the actual string entered. Here is a short example session: Code: >>> a = raw_input("Input variable: ") Input variable: 5 >>> a '5' >>> a * 3 '555' >>> int(a) * 3 15 >>> |
| As you can see multiplying a string simply cause the string to be repeated n times. int(a) will try and convert a string to a number (integer actually).
|
« Last Edit: Aug 10th, 2008, 5:04am by Janzert » |
IP Logged |
|
|
|
Tuks
Forum Guru
Arimaa player #2626
Gender:
Posts: 203
|
|
Re: Language learning
« Reply #14 on: Aug 11th, 2008, 7:23am » |
Quote Modify
|
the problem is i can't keep going, it gives me an error message i press enter after i have finished typing then it executes the command then when i press enter again it shows me the error message. How would i copy it to show you? like you showed me
|
|
IP Logged |
|
|
|
|