Toribash
Prev Previous Post   Next Post Next
Original Post
[WIP] Perceptron
I'm currently educating myself in Lua with a specific focus on the Toribash API, for what I consider fairly obvious reasons. As a first project, I thought I'd do something interesting in concept and not very hard to implement; use of a perceptron to generate a "move" which meets certain requirements.
If you're not familiar with what a perceptron is, it's quite basically a simple model of a neuron, and I'll outline one below. By using a single one of these, I have so far successfully implemented a "move generator" which will eventually meet a specific set of requirements. At the moment it isn't very intelligent at all, which is why I am not posting the source yet. It brute-forces moves with repetition (*gasp*, that's horrible!), so I'll spend the next few hours working on a more intelligent system that won't be too memory intensive.

A perceptron takes two or more "inputs" and produces an output. One input is internal - a natural bias. Inputs are multiplied by a "weighting" factor and then the perceptron's internal processing determines the output (always a boolean value).

Any comments or suggestions would be appreciated!

Release Notes
v1:
  • Implemented a basic genetic algorithm. By default, 100 damage points = 1 fitness point and 1 body part detachment = 50 fitness points; this is fully customisable depending on how much you like detachments.
  • Not making full use of the perceptron structure yet. At the moment, it generates moves endlessly rather than stopping when it meets a set requirement.
  • You may want to set turnframes to 50 so that you actually have a chance to hit the opponent.

Planned Features
  • Saving of the top n movesets and their fitnesses (in order of fitness).
  • Stopping after meeting the target requirement.
  • Some adjustments to the algorithm; it's not as good as it perhaps could be.
  • Multi-turn moves! One turn really isn't enough for a great move, but for now just an opening move will do.
Attached Files
percy.lua (2.9 KB, 44 views)
Last edited by ZaggZigg; Aug 4, 2011 at 12:12 PM.