(I have a few ideas how to programme this, but none of them was checked, so feel free to help. All ideas are welcome.)
------------------------------------------
Task:
You have weighing machine (classical two bowl scale). You can use it only three times.
You also have 12 objects of the same shape (I haven't decided which exactly, but that doesn't matter now).
1 object has a "different" weight than the others - it is lighter or heavier.
=> find that object.
Here is a solution: "http://www.newton.dep.anl.gov/newton/askasci/1995/math/MATH007.HTM"
------------------------------------------
Now, how to implement this in aoc scenario?
I guess the only way how to do that is to use AI signals.
Problems we have to deal with:
- There is 12 objects => a lots of combinations.
- How to count how many objects is on each bowl (in our case area) and how to compare numbers which we get?
- How to set weight of object?
-------------------------------------------
1. Easy part = How to set weight of object?
(defrule
(event-detected trigger 1) ; Start of task
=>
(generate-random-number 2)
(set-signal 0) ; YES
(set-goal 1 1)
(disable-self)
)
(defrule
(goal 1 1)
(player-number 2)
(random-number == 1)
=>
(chat-to-all Light") ; Armor is light*
(disable-self)
)
(defrule
(goal 1 1)
(player-number 2)
(random-number == 2)
=>
(chat-to-all "Heavy") ; Armor is heavy*
(disable-self)
)
-------------------------------------------
*in a real game there will not be chat-to-all, but another set-signal syntax. This is just for check.
------------------------------------------
Task:
You have weighing machine (classical two bowl scale). You can use it only three times.
You also have 12 objects of the same shape (I haven't decided which exactly, but that doesn't matter now).
1 object has a "different" weight than the others - it is lighter or heavier.
=>
Here is a solution: "http://www.newton.dep.anl.gov/newton/askasci/1995/math/MATH007.HTM"
------------------------------------------
Now, how to implement this in aoc scenario?
I guess the only way how to do that is to use AI signals.
Problems we have to deal with:
- There is 12 objects =>
- How to count how many objects is on each bowl (in our case area) and how to compare numbers which we get?
- How to set weight of object?
-------------------------------------------
1. Easy part = How to set weight of object?
(defrule
(event-detected trigger 1) ; Start of task
=>
(generate-random-number 2)
(set-signal 0) ; YES
(set-goal 1 1)
(disable-self)
)
(defrule
(goal 1 1)
(player-number 2)
(random-number == 1)
=>
(chat-to-all Light") ; Armor is light*
(disable-self)
)
(defrule
(goal 1 1)
(player-number 2)
(random-number == 2)
=>
(chat-to-all "Heavy") ; Armor is heavy*
(disable-self)
)
-------------------------------------------
*in a real game there will not be chat-to-all, but another set-signal syntax. This is just for check.
[This message has been edited by Magor Willi (edited 07-15-2010 @ 11:51 AM).]