• Smogon Premier League is here and the team collection is now available. Support your team!

programmers unite

I'm mostly using Python now. Django has made web development much more interesting to me, and as a result I'm finally interested in learning JavaScript. Any resource suggestions? I could use a good "javascript for programmers" intro and some guidance with libraries.
 
Jshadias - I suggest trying out Colubrid/SQLAlchemy/Mako templating/FormEncode. That's the setup the new site uses; I didn't find Django customizable enough for my needs so I took a bunch of "best of breed" components and put them together and I quite like the result. That kind of power might be overkill, so whatever.

JavaScript is a really misunderstood language, so it's hard to find a lot of GOOD documentation on it. It's pretty barebones as is so I suggest trying out www.jquery.com jquery, which is a 20kb framework for writing js. It helps out a whole lot and there is a wealth of shit available for it like autocompletion of textboxes, fancy visual effects, etc.

One thing to remember: semicolons are optional!
 
I'm having to use Pascal for my science project. I am making a program that can redigitize sound waves for hearing impaired people (like me).

It's going to use a lot of FFT algorithms and everything. Is there anything I should know about Pascal compared to the other common programming languages like C++ and Java?
 
The only two reasons why I use Java over C++ are:

1) At the time I was a second year student at university in 1998-1999, Java was hailed as the next best thing, and that was the language that they chose to teach us.

2) It is free. (I don't think C++ compilers are. If they are also free, ignore this reason.)

To Vavath, are you using an object-oriented version of Pascal? If not, then that's the biggest difference between Pascal and C++/Java.
 
C++ compilers are free on every platform. The flagship compiler used to compile Linux, BSD, and others (GCC) is not only free as in money, it's open source as well. The Visual Studio compiler is free as well for download from Microsoft's website, but you'll have to pay a hefty penny to get the cool IDE that comes with it. It's a much better choice than GCC on Windows.

In fact, it wasn't until Sun was given competition from Microsoft's .NET that they open sourced Java.

Vavath: C/C++ or even Assembler would be more appropriate for that project. C compilers are more advanced than their Pascal counterparts (probably because C is a more popular language) and tend to produce better results. Plus, I don't think Pascal has pointer arithmetic which can be used in certain situations to speed up algorithms (usually advanced quicksorts use it; I don't know about applications in other areas)
 
I taught myself how to program on on a TI-83+, which gave me a huge headstart when I started basic A later that year (it also helped me a ton with my math homework ;-)). I took comp sci the following year and learned visual basic, then went on to comp sci 2 AP and learned how to do a few things in java.

I don't think I'll be taking too much programming in college, and I know I won't this year (mainly because I placed out of it). I'm gonna go for a different engineering degree most likely. Still, I can understand most programmnig conversations and can write a subclass or two for a bigger program.

However, I have a friend who's great at programming. He taught himself c++ to help work on the star wars galaxies emu. He's great at computers.
 
Well seeing as I'm gonna break my silence:

Currently Computer Science major going into Junior year. Know some C++, a bit of Java, and taking a course on Visual Basic this coming semester.

On a side note, I'm also familiar with M.U.G.E.N. coding and Rubikode, the language used to create scripts in the Pokemon GBA ROMs back when I was doing my GSC remake before the project got ditched, although I doubt those two count as true languages.

Also, the fan-made game Megaman 21XX was coded entirely in C++ from what I've heard. I guess this is what sparked me into taking up programming.
 
My programming knowledge is extremely limited, but I've dabbled in a few. I've currently completed AP Computer Science 2, and am going into 3.

  • Java. It's the language my school teaches me. I've done quite a few things in it, including an RPG, various small applications (Banking system), a PokĂ©mon AI complete with GUI, and, of course, my FixEVs applet.
  • JavaScript. I love this language. Also, an open-source game maker (Sphere) uses SpiderMonkey for programmers to program their games in from scratch, plus some added functions by the creators (the core engine is in C++). Unfortunately, Sphere has a shitty map editor. I've made plenty of really cool games with it, though. (Tetris! Ice Paths! And, of course, an RPG.)
  • C/C++. I was supposed to learn C++, but summer camp dumped me in C. Whatever. The extent of my C knowledge is "printf()", and my C++ knowledge consists of: #include <iostream> and std::cout << "Hello world!" << std::endl;
  • Ruby. I programmed an RPG here as well. It's still on my computer, actually. I've forgotten a lot of Ruby, but it should just take a refresher course to remember all of it again. As I recall, it was an extremely fun and easy to use language.
  • LOGO. Microworlds used this language, I'm not sure if any of you recognize the name. Its mascot: a turtle. Personally, I hated it (last time I used it was... about 5 years ago). But one of the counselors at camp created a 3D application with Microworlds, so that's pretty cool.
  • BASIC. Don't ask me to program anything. I've forgotten everything.
  • Whatever the TI-83+ uses. Made some long text-RPGs on it when I was little. My friends enjoyed it, seeing as I was a good writer (still am, but even better now). Good times.
I had also written a game, CubeX, in Pascal, at around 1999-2001, together with several (smaller) games and programs. I once gave this game to Sarenji, lol.
That game was awesome.
First thing I ever programmed was Lego Robotics.
Haha, I loved doing that. Got tired of it after a month, though... pity.
 
Jshadias - I suggest trying out Colubrid/SQLAlchemy/Mako templating/FormEncode. That's the setup the new site uses; I didn't find Django customizable enough for my needs so I took a bunch of "best of breed" components and put them together and I quite like the result. That kind of power might be overkill, so whatever.
There's no reason to use Colubrid for me. SQLAlchemy is very nice though, and Mako would be an improvement since Django's templates are pretty restrictive. I'll definitely look at using them if I start something new.

JavaScript is a really misunderstood language, so it's hard to find a lot of GOOD documentation on it. It's pretty barebones as is so I suggest trying out www.jquery.com jquery, which is a 20kb framework for writing js. It helps out a whole lot and there is a wealth of shit available for it like autocompletion of textboxes, fancy visual effects, etc.
Haven't had time for this yet, but thanks for the reference.

One thing to remember: semicolons are optional!
Awesome.
 
no problem j

sarenji, could I eventually get you to write an AI bot for Competitor? I know Brain talked about this once before too...
 
I am interested in the development of the AI bot too.

EDIT: Actually, scratch that. After thinking deeply about this, I think such an undertaking will be a waste of time, if you want to make a decent AI bot.

I might sound pessimistic, but a decent Pokemon AI bot is a tremendously difficult thing to do. The reason is that there are simply way too many exceptions in Pokemon.

Compared to Pokemon, a Chess AI is a breeze to construct, having only 6 differing pieces, and always starting from the same position. In Pokemon, there are around 265 fully-evolved Pokemon to contend with, each with their own abilities, stats, items and typing. Would an AI bot be able to effectively use a Speed Boost Ninjask set having Protect, Aerial Ace, Swords Dance and Baton Pass? Would an AI bot be capable of knowing that Natural Cure combos with Rest? That Sleep Talk combos with Rest? Maybe Rest + Sleep Talk might be recognised as a combo by an artificial bot, but for the others, I really doubt it would know how to play them out. I actually doubt the AI being able to wisely use any stat-upping set, for that matter, let alone a Baton Passing one. In short, what's worrying me about the AI bot is that it wouldn't be able to use non-damaging moves properly.

For this reason, even though previously I said that I was interested in this, I will now just give a hearty "good luck" to whoever it is assigned to. However, if this project is discontinued mid-way, or if the AI bot turns out to suck badly, don't say I didn't warn you.

To all the programmers and AI people out there, if I'm wrong in what I wrote above, please tell me where, because I really wish I'm wrong. I'm a realist, though.
 
If you want me to hijack this thread just say so, mate.

Anyway, X-Act, I wouldn't say it's an easy problem but I wouldn't say it's as hard as you think. First, using statistics about real teams and their use in battle, you can significantly prune the amount of options, allowing the AI to determine, say, 10 outstanding possibilities for the opponent's next move and 10 outstanding possibilities for a pokemon it could switch to (moves and pokemon are also distributed conditionally to each other). Assuming the bot has access to a simulator for the game, it would allow it to play a few rounds in advance in a min/max fashion. With a good function to evaluate how well it is doing (I am pretty sure there are simple quality heuristics for that) and given the fact that some options dominate others and can thus be pruned in the search, I think it's worth a try. You can deal with the random element by repeating the simulation as many times as needed to estimate the expectation.

There are other things to try, of course. One would be to take thousands of battle logs and try to learn how to predict the opponent's next move given the state of the game (what state? - that's the biggest problem). If you do that well, you can use prediction to your advantage and/or you can use the knowledge as a guideline to how to play yourself, effectively turning into a typical human player. More simply, you could learn the factors that lead to victory. For example, if the bot observes that the situation "garchomp + 2 DD" makes the garchomp user victorious 90% of the time, it can add that situation to its database of good situations and try to reproduce it, though ideally it should be able to generalize that knowledge. I'd go for a learning approach, myself. First learn how good humans play then use that knowledge to beat them.

Also, it's not impossible that a simple AI that doesn't know much would perform well.
 
Thanks for clarifying things, Brain.

I was discussing things with Sarenji over MSN right now. We were basically seeing how the bot could learn what to expect from the Pokemon it's facing. I think we actually found a good rough implementation (an abstract one, of course, for now), which is based on what you mentioned in your post (mainly previous experience of what the particular Pokemon did to the bot in previous games/turns). I'm glad that all of us - you, Sarenji and I - went for the learning approach to the AI bot.

I'm realising that Pokemon does have a big advantage over chess: in Pokemon, you only have at most 9 different choices to make (use one of your 4 moves, or switch into one of your 5 other Pokemon), whereas in chess this number can be much more.

A problem I'm thinking of is - should the bot be expected to also modify its team, or will it just use predefined teams?

I still don't know how to make the AI bot know when to use Swords Dance, or know when to use Baton Pass, or things like that, but I guess I don't know everything. Since you seem to know about how would you go about solving this particular problem, I will make another u-turn - if you and Sarenji want some help (mainly algorithmic, since I might not know the programming language that will be used for the implementation of the bot), I'm interested.
 
To move off the topic of AI bot for a minute...

Last night, chaos and I were discussing Unix (or POSIX, whatever) and its problems. We decided the main issues were its method of handling system accounts for, well, everything. We found it problematic that most, if not virtually all, server daemons depended on system accounts for purposes of authentication and storage; we also found it quite problematic that so much expects mail sent to system accounts. Why should system accounts need a mail box? Probably because the design is stuck in the 70s.

In any case, we discussed what all would need to be changed or created to fix these problems of Unix, and came up with the following list so far:
* Mailer daemon, needs to not depend on system accounts. So far I do not know of any that support this, but many (such as Exim) are so large that they conceivably have this in their feature set. If such is the case, it would need to be easier to use this, as easy as the default.
* Alternative ways of messaging users, as in, not email. Email should be completely separate from system messages by default.
* Allow non-root users to open ports below 1024. Alternatively, make what ports can be opened by what users easily configurable.
* A better syslog (could go hand-in-hand with the messaging/email thing).

Apparantly pure-ftpd allows you to use such 'virtual' users, but what other servers lack a daemon capable of supporting virtual users? What else would be needed to fix Unix?

edit: I've examined exim a bit more and it's apparently possible to do virtual users with a mysql database (and probably with postgresql and ldap as well), but I'm not sure about cutting off system users. I also think it's way too hard to do anything in that program -- the amount of configuration that you can (and need to) fine-tune is insane.
 
BSD has newsyslog, which does log rotation - that's a big step in the right direction. The ports thing is apparently fixed in a few lines of code, which is pretty cool since I personally believe it makes Unix -less- secure. You know what else would be nice? A case-insensitive shell and/or filesystem by default. That's such an archaic design; there's no reason why a modern computer should treat makefile and Makefile as different files. I can't think of any case where you would want to have makefile for 1 configuration, Makefile for another configuration, MakEfilE for yet another, and of course the standard MAKEFILE for the final build!

Here's something else that sucks: Makefiles.
 
To move back onto the topic of AI for a moment...

Another reason pokemon bots cannot approach chess bots is the fact that pokemon does contain luck. In Chess, a computer can predict with exact accuracy all possible outcomes of all possible turns a given period ahead of time, allowing it to consider all potential moves occuring five turns in the future. This can't really be replicated with pokemon, because a critical hit, etc. will obviously fuck shit up.

So approaching it in the manner that chess bots are coded (heavy recursion) probably isn't the answer. Instead, you would probably want to use rule-based checks or maybe even a "learning" bot using some sort of genetic algorithms. Or, you could use a rule-based system to create a list of possibly good moves, and genetic algorithms to settle on an agression factor.
 
I was discussing things with Sarenji over MSN right now. We were basically seeing how the bot could learn what to expect from the Pokemon it's facing. I think we actually found a good rough implementation (an abstract one, of course, for now), which is based on what you mentioned in your post (mainly previous experience of what the particular Pokemon did to the bot in previous games/turns). I'm glad that all of us - you, Sarenji and I - went for the learning approach to the AI bot.

There is much more to lever than the bot's own experience. Assuming there are 500 battles per day on the main competitor server, 20 turns per battle (I don't know if those figures are accurate), you're looking at 20,000 actions to analyze every day, which is not negligible.

A battle's state could be each pokemon's stats (or estimations thereof), types, boosts, status, weather, as well as all the flags like mean look and spikes and counts like the perish count. You can then view each possible action as modifying the state in a certain way. This allows you to do without the concepts of pokemon, move, item or ability. For example, switching to Tyranitar, instead of being an action number, would change the stats and types, reset the boosts, whip up a sandstorm, etc.; if you determine that going to a state where the type is rock gives you an edge, then obviously switching to Tyranitar will help you. If new pokemon and/or moves are added to the mix, the AI will adapt more easily. Seen under that angle, you want to know what a good state is and you want to manipulate the current state to make it better. Of course, it also helps to know how your opponent is going to manipulate the state.

I'm realising that Pokemon does have a big advantage over chess: in Pokemon, you only have at most 9 different choices to make (use one of your 4 moves, or switch into one of your 5 other Pokemon), whereas in chess this number can be much more.

In the first turn of a battle, using an uniform prior, the opponent could use any move his pokemon can possibly learn or he/she could switch to any of 493 possible pokemon, each of which could be personalized in zillions of ways. Hence why it's important to only consider likely possibilities, and who knows how many of those there are (not that many fundamentally different ones).

A problem I'm thinking of is - should the bot be expected to also modify its team, or will it just use predefined teams?

Eh, I don't know. It'd be cool if it could build its own teams.

I still don't know how to make the AI bot know when to use Swords Dance, or know when to use Baton Pass, or things like that, but I guess I don't know everything. Since you seem to know about how would you go about solving this particular problem, I will make another u-turn - if you and Sarenji want some help (mainly algorithmic, since I might not know the programming language that will be used for the implementation of the bot), I'm interested.

If the bot knows that having attack boosts increases its odds of winning (which is evidently true under certain simple conditions that could be learned), it will try to do that as much as it will try to damage the opponent. If it judges that the odds of winning are superior if pokemon Y gets the boosts, it might baton pass to it.


Nate said:
Another reason pokemon bots cannot approach chess bots is the fact that pokemon does contain luck. In Chess, a computer can predict with exact accuracy all possible outcomes of all possible turns a given period ahead of time, allowing it to consider all potential moves occuring five turns in the future. This can't really be replicated with pokemon, because a critical hit, etc. will obviously fuck shit up.

The effect of luck is that perfect play cannot result in a 100% win rate: it will be lower in proportion to the amount of luck (a 50% win rate in the case of pure luck). It doesn't matter in the long run, though: the more games are played, the more skill will stand out (statistically). That's annoying for impatient human players, but it's the best that can be done :) You can take luck into account during play by simulating the next rounds over and over again, so you get a precise idea of your winning expectancy. You can then choose the action that is the best on average (or an action that's a bit below average but has a lower risk (variance)).

So approaching it in the manner that chess bots are coded (heavy recursion) probably isn't the answer. Instead, you would probably want to use rule-based checks or maybe even a "learning" bot using some sort of genetic algorithms. Or, you could use a rule-based system to create a list of possibly good moves, and genetic algorithms to settle on an agression factor.

Rule-based AI is limited, can't follow the metagame and it is not scalable at all. I don't think it's a good idea.
 
My point regarding luck is that you cannot approach pokemon bots in the same manner as a chess bot (heavy recursion). That is all. The fact that you cannot accurately predict what the board will look like in a move but instead will either make recursion algorithms useless or require absolutely massive amounts of resources. I'm not commenting in any way shape or form on the effect of luck on the game of pokemon. Please grant me enough respect to actually read my posts before replying with amazingly apparent information which is also entirely irrelevant to programming an ai bot.

Simulating the next rounds over and over again is not a feasible strategy due to the massive amounts of potential moves. On a given turn, each player has 9 potential moves (5 switches, 4 attacks). In addition, however, you would have to calculate multiple scenarios for each attack (min/max/avg damage), random effects (say thunderbolt paralysis), more random effects (say fully paralyzed) for each player in combination. Without knowing all 6 of your opponents pokemon and all 24 moves, a recursive formula becomes even more unattractive. Creating an even moderately comprehensive picture of the potential board only one turn is either inaccurate or resource heavy. Using a recursive strategy to predict the board even a mere 5 turns ahead would decimate even my beautiful new fx-62.

A very specific rule-based AI would indeed have trouble following the metagame. However, the bot would not need to be entirely rule-based. Instead of hardcoding into the bot "If you see an alakazam, switch to blissey," you would program in a far more generic algorithm. "If you are expecting a strong special attack and your current pokemon cannot absorb the attack (or it is not worth absorbing the attack), switch to a pokemon which can absorb the attack." The next step in that progression is creating that oh so hyped element in pokemon, prediction. Genetic algorithms come into play here. Create a slew of potential reactions to the situation of expecting strong special attack against pokemon which is not expected to absorb it (attack predicting the stay, attack predicting switches, switch to pokemon which walls attack, switch to pokemon which best takes advantage of their pokemon), then use genetic algorithms to slowly alter probabilities of a given scenario being chosen.

Genetic algorithms can be used in two different ways here: predicting the move your opponent will use (though this can also be done through straight record-keeping and analysis) and to determine potential reactions to that move.
 
I was wondering if I could use this thread as a venue of asking help for my assignment (due at the end of the month). I'm sorta stumped on how to do it. This is to be done in Java btw.

Basically I have to make a program that asks the user to choose which of the following he wants to do:
1 - convert binary to decimal
2 - decimal to octal
3 - octal to hexadecimal
4 - hexadecimal to binary
5 - quit program

Now so far, I've done the main menu interface and I am making no headway in the programming of the conversions. I'm pretty sure my professor would like the program to have separate classes for each number system conversion.

Thanks in advance to anyone who tries to help.
 
Back
Top