|
||||
Title: Language learning Post by Tuks on Jul 25th, 2008, 10:36am 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? |
||||
Title: Re: Language learning Post by Fritzlein on Jul 25th, 2008, 11:37am 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 (http://www.python.org/) 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 (http://el-ass.blogspot.com/) 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. :) |
||||
Title: Re: Language learning Post by Tuks on Jul 25th, 2008, 12:43pm thank you, very helpful |
||||
Title: Re: Language learning Post by nbarriga on Jul 25th, 2008, 1:29pm 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!!!) :) |
||||
Title: Re: Language learning Post by Janzert on Jul 25th, 2008, 4:54pm 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" (http://en.wikipedia.org/wiki/Conway%27s_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 |
||||
Title: Re: Language learning Post by Tuks on Jul 26th, 2008, 11:49am 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? |
||||
Title: Re: Language learning Post by nbarriga on Jul 27th, 2008, 9:17am 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. |
||||
Title: Re: Language learning Post by arimaa_master on Jul 27th, 2008, 10:07am For free C++ interface and compiler under Windows "Dev-C++" seems to be good choice. |
||||
Title: Re: Language learning Post by Janzert on Jul 27th, 2008, 11:27am 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 |
||||
Title: Re: Language learning Post by Tuks on Jul 27th, 2008, 6:12pm 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 |
||||
Title: Re: Language learning Post by 99of9 on Jul 27th, 2008, 8:21pm on 07/27/08 at 10:07:17, arimaa_master wrote:
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. |
||||
Title: Re: Language learning Post by BlackKnight on Jul 29th, 2008, 9:39am I also used Dev-C++ before but I switched to Eclipse (for Java and C++) over a year ago. (For Linux and Windows.) |
||||
Title: Re: Language learning Post by Tuks on Aug 10th, 2008, 4:04am 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? |
||||
Title: Re: Language learning Post by Janzert on Aug 10th, 2008, 5:01am 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:
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 (http://gisdeveloper.tripod.com/scite.html) 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:
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). |
||||
Title: Re: Language learning Post by Tuks on Aug 11th, 2008, 7:23am 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 |
||||
Title: Re: Language learning Post by Janzert on Aug 11th, 2008, 8:37am on 08/11/08 at 07:23:40, Tuks wrote:
Ahh, without seeing the error message here's my first guess on what is going on. Like I said above after you enter the first line and hit enter, it immediately executes that line. This means that it actually wants you to enter the multiplier number right then. If you just hit enter again it will give an error because it can't get any value from what you entered to assign to the multiplier variable. In order to copy the output it depends on how you're running the interpreter. The way I normally do it and I'll take a guess that you might be doing the same is to run python from a command prompt. In order to copy out of a command prompt you right click and select "mark". Then click and drag to select the text you want to copy and right click again once you have it selected. You can then paste it wherever you need to like you normally would. Janzert |
||||
Title: Re: Language learning Post by Tuks on Aug 11th, 2008, 9:04am i got it, thank you, so simple and yet i had to read your last message twice before i understood that i needed to add the number after the output (which you did state) ;D |
||||
Title: Re: Language learning Post by Fritzlein on Aug 11th, 2008, 12:13pm A trivial misunderstanding results in completely non-functional code and hours of frustration. This is why I am not a programmer! Tuks, you have had the great fortune to experience this reality early in your programming career. Run away, while you still can. Any fate is preferable to learning Vim, to say nothing of coming to love and rely on it. It's not too late to study math instead... |
||||
Title: Re: Language learning Post by Tuks on Aug 11th, 2008, 1:04pm i m studying math in school, its required to take programming classes in college :o thought ide get a head start on it its confusing and time consuming but the idea of my own bot is driving me on!!! :P |
||||
Title: Re: Language learning Post by Janzert on Aug 11th, 2008, 5:46pm Quote:
on 08/11/08 at 12:13:16, Fritzlein wrote:
Hmm, I may have to go back and edit that first quote. :P Janzert |
||||
Title: Re: Language learning Post by Fritzlein on Aug 11th, 2008, 6:25pm Heh, I'm just yanking your chain, Janzert. I confess that I have used both vi and emacs out of necessity, never got comfortable with either, and grew to dislike them both. But then again, I've never written a program more than a couple hundred lines long, so I have never had to outgrow Notepad. :) |
||||
Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1! YaBB © 2000-2003. All Rights Reserved. |