udovisdevoh / anticulture

Automatically exported from code.google.com/p/anticulture
0 stars 0 forks source link

Operators with variable behavior (notably, the Strike Operator) #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem:
If we use the operator "Strike" to strike two stones in order to spawn
fire, what operator would we use to strike two stones in order to spawn a
cutting stone? We could use a very similar operator (i.e. a Rub or
Strike2), but what about striking two stones in order to spawn an arrow
head? And what about every other stone age tools that could be spawned by
using the "strike" operator. We would need countless "Strike-like" operators.

Proposed solution:
We could use the "strike" operator with that syntax:
Strike(Who, What1, What2, How);
as the argument "how" represents the way the operator is used.

Examples 1:
Strke(Me, Wife, Wall, How);
In that example, a human strikes his wife on the wall. There is only ONE
way to do it so the How argument is null by defaut.

Examples 2:
Strike(Me, Rock1, Rock1, 0);
A human spawns a fire using the strike operator with argument How = 0
(default value)

Examples 3:
Strike(Me, Rock1, Rock1, 0);
A human spawns a cut stone using the strike operator with argument How = 1 

* With that kind of proposed logic, the operation prototypes will be
distinct when the "How" argument is different.

Original issue reported on code.google.com by glaca...@gmail.com on 1 Dec 2007 at 4:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
In example 3, you meant "Strike(Me, Rock1, Rock1, 1);", right?

Well I don't like your solution much as it would somewhat break the current
genericity of operations (which all take a Human and an array of Entities). 
Would
some operations take an additional "how" integer? Would _all_ operations take an
"how" integer, but most of them would ignore it? How could the entity know in 
which
range the "how" operator is valid?

I understand the nature of the problem you're describing but, for the moment, I 
think
it'd be simpler to have, not different types of "strike" operations, but 
different
kinds of rocks (silex, _pierre des champs_, _cailloux_, _galets_, etc.). For the
moment, this means having a lot of "if else if" in Operations.Strike.Update, 
but I
don't see a way around this right now.

Original comment by tristanl...@gmail.com on 2 Dec 2007 at 3:14

GoogleCodeExporter commented 9 years ago
Ok, having multiple kinds of rocks is fine with me. 

Original comment by glaca...@gmail.com on 2 Dec 2007 at 5:01

GoogleCodeExporter commented 9 years ago

Original comment by glaca...@gmail.com on 4 Dec 2007 at 3:46