sufendyc / battleships

Open platform for developing and fighting bots.
2 stars 2 forks source link

Infer the language used by each bot and display it on the UI #14

Open jhibberd opened 10 years ago

ethanckw commented 10 years ago

Would it be feasible if we just check the file extension to determine the language for the script?

jhibberd commented 10 years ago

I think a more robust way to do it would be to use the same method as the OS and check the shebang in each bot file: http://en.wikipedia.org/wiki/Shebang_(Unix)

We could have a mapping (a simple python dict) between supported shebangs and their languages. The server could then add this as a property to a bot when it's uploaded and saved to the database.

On the person's bot page you would see the language used for each individual bot (which may vary). On the leaderboard you would see the language used by each person's best bot. This should probably be denormalised in the user's database collection similar to how the best score is maintained.

Feel free to code it up and create a pull request.