| Author |
Message |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 1 Registered: 8-2011
| | Posted on Wednesday, August 17, 2011 - 11:45 pm: | |
Okay, I just typed all this and it didn't post, so here we go again. I made my first zrf. It is the game Thud. Rules are at www.thudgame.com. The computer sucks at it, often suiciding and ignoring threats. I think the computer might get a little smarter if I can somehow tell it that trolls are worth 4 points and dwarves are worth 1. The game ends when a mutual decision is reached that no more captures can be made, assuming a level of competency in both players. Since this is too vague for ZoG, I figured you can just stop playing when you reach that point. Still, the computer needs a goal to aim for so I entered: (count-condition (DWARF TROLL) stalemated) as the only win condition. I think if I can make this more complex, the computer will do better, but I can't figure out what to put, especially to impart the 4 to 1 ratio of piece power. Any ideas?
|
Greg Schmidt (Gschmidt2)
New member Username: Gschmidt2
Post Number: 136 Registered: 1-2007
| | Posted on Thursday, August 18, 2011 - 8:34 am: | |
I can't think of a way to improve on your goal condition. There might be some roundabout way to express the goal directly by iterating through all positions and using attacked? on those squares that cause pieces to be captured, then creating a dummy piece when no attacks are found and then using its presence as a goal condition... but I suspect that would end up being too complex, costly and unwieldy to even consider as a viable approach. Strangely, and from my limited understanding of your game, I would think that Zillions built-in mobility+material evaluation would work well for your game. I'm a little surprised that it doesn't, but maybe it has more to do with your piece valuation being off as you suggest. When I turn on "show values", the troll is at 8500 and the dwarf at 57500 so that's way off (6:1 vs 1:4) from where you believe you need to be. There are a number of useful posts in this forum concering "tweaking" which is really just a way to influence Zillions valuation by generating multiple moves. Look for posts on this topic by Mats Winther, Keith Carter, and Karl Scherer. I think that's your best bet right now. |
Keith Carter (Keithc)
New member Username: Keithc
Post Number: 182 Registered: 8-2000
| | Posted on Thursday, August 18, 2011 - 11:40 am: | |
I will take a look at the zrf, probably tomorrow evening. My Cannon AI uses a lot of AI manipulation. I expect the dwarf slide move vs the troll step move is making the material difference. I am a little rusty on Zillions AI manipulation but the basic idea is to give trolls moves that never get used to increase the value Zillions assigns to the piece. See the topic AI Prodding in this same subsection of the board. Move priorities are usually involved so the value manipulating move never gets reached. The value manipulating move itself will be empty adds and look something like this: (moves (add add add)) ) |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 2 Registered: 8-2011
| | Posted on Thursday, August 18, 2011 - 2:03 pm: | |
Just to be clear. The 4:1 power thing is a rule, not just an opinion. When scoring at the end, Trolls are worth 4 points and Dwarves worth 1. In actual practice, I would guess that a Troll could be worth as much as 7 times a Dwarf. Trolls usually win the game especially in beginner matches, but it is open to debate as to who wins with near perfect play. |
Keith Carter (Keithc)
New member Username: Keithc
Post Number: 183 Registered: 8-2000
| | Posted on Thursday, August 18, 2011 - 2:50 pm: | |
I understand where the 4:1 comes from. The value of a troll can be manipulated for the official 4:1 or 7:1 (possible actual) as you see fit. Or create seperate ZRFs for each and see which plays best. |
Larry Wheeler (Brainburner)
New member Username: Brainburner
Post Number: 1 Registered: 3-2007
| | Posted on Thursday, August 18, 2011 - 2:53 pm: | |
You can adjust the value of the positions by storing pieces in dummy locations. Call the pieces 'points' and store pieces for each side in proportion to what they're worth for the win. You'll have to capture the right number of these every time a real piece is captured. This should drastically improve the play. If you want to simulate agreement by both players, you can have a special move, similar to a pass, that changes the position (e.g., by placing a piece off-board), so that if the other player immediately does the same thing, the game ends. Then you could use a count-condition to automatically determine the winner, based on points. The problem is, Zillions would rather repeat the position than lose, so you'll have to make repetition a loss, too. You still might have the game go on too long as Zillions tries to avoid losing. Hope this is not too confusing! |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 3 Registered: 8-2011
| | Posted on Thursday, August 18, 2011 - 6:44 pm: | |
"I understand where the 4:1 comes from. The value of a troll can be manipulated for the official 4:1 or 7:1 (possible actual) as you see fit. Or create seperate ZRFs for each and see which plays best." Right. That's what I'm asking how to do. How do you set a weight for the pieces? Like I said, this is my first zrf, and I can't find any keywords in the help file that mention how to weight pieces, nor did I see any example of it in the chess.zrf file. Brainburner's option of dummy pieces seems to be feasible but bulky and complicated. |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 4 Registered: 8-2011
| | Posted on Thursday, August 18, 2011 - 6:59 pm: | |
Okay, I'm reading the AI Prodding topic now. I missed that earlier in the thread. |
Keith Carter (Keithc)
New member Username: Keithc
Post Number: 184 Registered: 8-2000
| | Posted on Friday, August 19, 2011 - 7:05 pm: | |
I have taken a look at boosting the value of Trolls. Here is what you need to do: 1. Change the turn order to (turn-order (DWARF regular) (TROLL regular)) 2. Add (move-type regular) to the top of the dwarf move list. You get the following result (I think the forum will remove coding indents). (piece (name dwarf) (help "Dwarf: moves as queen, kills by throwing into Troll square") (image DWARF "dwarf.bmp") (moves (move-type regular) (throw n s) (throw ne sw) (throw e w) (throw se nw) (throw s n) (throw sw ne) (throw w e) (throw nw se) (slide n) (slide ne) (slide e) (slide se) (slide s) (slide sw) (slide w) (slide nw) ) ) 3. Add (move-type regular) to the top of the troll move list then add (move-type unused) to the bottom of the troll move list. On the next line after that put in a move or moves. That move will increase the troll's value but never get played. I use a move that is just multiple add commands (add add add add ... etc) till the right material advantage is reached. The number of adds is trial and error. For a 4:1 troll to dwarf ratio use 88 adds. Troll value will then be approx. 229,744 to 57,490. For a 7:1 ratio use 158 adds for a troll value of 402,924. For the 7:1 version the troll piece definition will look like this: (name troll) (help "Troll: moves as king, kills by moving into proximity, may be shoved to kill") (image TROLL "troll.bmp") (moves (move-type regular) (shove n s) (shove ne sw) (shove e w) (shove se nw) (shove s n) (shove sw ne) (shove w e) (shove nw se) (move-type unused) (add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add add) ) ) |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 5 Registered: 8-2011
| | Posted on Saturday, August 20, 2011 - 7:24 pm: | |
Okay, yes, I did something like that to the zrf after reading the AI Prodding topic. The Trolls are much smarter now and play a decent game when I am the Dwarves. Now the computer Dwarves are stupid. Well, they always have been. Not much changed for them when I fixed the Trolls, except now they are always sure to capture when they can as the Troll is worth more. Strategy for the dwarves is to form into a cohesive block. So I decided I would give a dwarf a boost if he can stand next to other dwarves, and those dwarves would also boost because of him, so the bigger and more circular-shaped the group (thin lines are not as rewarded), the more exponentially powerful it becomes, hopefully to the point where a Troll would sacrifice himself to bring it down, and the Dwarf player would sacrifice dwarves to build it up. So I did something like this: (define powerpack( $1 (verify friend?) (go from) add add add add add) ) and then in the dwarf move list... ...(slide w) (slide nw) (move-type unused) (powerpack n) (powerpack ne) (powerpack e) (powerpack se) (powerpack s) (powerpack sw) (powerpack w) (powerpack nw)) There was no discernable effect form this. So I tried 15 adds, then 30, then 150, then 450. No good. The thing is that Zillions counts the moves for power even if the verify statement fails, unless it fails because the move is off the board or on a kill space. So these bonuses I'm giving to the dwarves are being applied in the eight directions all the time. If you pause the game after all a dwarf's friends have left it, it is still valued at the high value. How do you make Zillions completely ignore some possible adds? |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 6 Registered: 8-2011
| | Posted on Sunday, August 21, 2011 - 11:48 pm: | |
Okay now I KILLED IT! I'm attaching the file that is apparently too complex for Zillions to handle, or has some glaring flaw that I can't even get a parse error. So if anybody has any ideas I'd like to hear them. The new changes that killed the program involved creating 9 types of dwarves, each one having a different amount of bare adds in them. Then I promote or demote dwarves based on how many other dwarves are adjacent to them. So a demotion is necessary every time a dwarf departs from a group, and a promotion is necesary at his new spot. Then, there is also the necessity to demote all the dwarves nearby when a Troll attacks. I think there is just too much piece-changing going on and it fried the program.
|
As Bardhi (Aepasa) New member Username: Aepasa
Post Number: 1 Registered: 1-2007
| | Posted on Monday, August 22, 2011 - 6:39 pm: | |
Hi Ryan, Yep! [The 'death' sentence to Zillions Engine is caused by define of death in your script. Check iT out!] Chears, Astrit |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 7 Registered: 8-2011
| | Posted on Monday, August 22, 2011 - 7:49 pm: | |
Yeah, I've been thinking about this all day, and I came to the conclusion it was the "define death" that was the problem, because Zillions doesn't handle things in the same order you code them. I was changing attributes of some pieces and then using "capture" on them, but Zillions captures them first and then changes the attributes causing an error. So I fixed that problem, but it still gives me a critical error. Unfortunately, I don't know what order other things are done in. There is a possibility within the code that a piece could have its attributes changed, get promoted, have its attributes changed again, and get promoted again, and in remote cases, maybe a third time of each as well. Now, if it happened exactly in that way, all would be fine. Or if it happened that all the attribute changes went first, then the promotions, that would be fine, too. However, I'm wondering if a) Zillions groups all the attribute changes together, which would cause logical errors, but still be playable, b) it doesn't allow multiple promotions to a single piece in a single move, c) promotions, like captures, come before attribute changes - logical errors, but playable, or d) all of the above. So if anyone could give me some insight into how this all works, that would help. |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 8 Registered: 8-2011
| | Posted on Friday, August 26, 2011 - 2:54 pm: | |
Well, I've got it working now, but the bonus to dwarves for grouping doesn't really help much, no matter how good I make it. It makes one pretty good move to start out, and then when the trolls make the obvious response, it sends out a bunch of suicide missions by moving next Troll hoping to kill it the next move if he's still alive. And sometimes the Troll falls for it when the computer is playing itself. So yeah, really stupid, both sides, even when I give it 15 seconds to think of a move. I'm thinking this game just isn't Zillions strong suit. |
Keith Carter (Keithc)
New member Username: Keithc
Post Number: 185 Registered: 8-2000
| | Posted on Monday, August 29, 2011 - 10:57 pm: | |
It may not be a good candidate for Zillions. The branching factor is very high. This will severely limit look ahead. For example the dwarf player has 736 possible first moves. |
Ryan Opp (Rytracer)
New member Username: Rytracer
Post Number: 9 Registered: 8-2011
| | Posted on Friday, September 02, 2011 - 7:34 pm: | |
AepasA emailed me: "can U please e-mail me your latest zrf file. I don't mind testin' iT, just tell me what I should look for" So I was going to email him the file but then I thought I should just put it here again in case anyone else felt the same way. As to what you are looking for, I'll give a brief Thud strategy lesson. Dwarves need to form a block so they can kill any Troll that approaches from any side. This is their primary objective. Once the block is formed, they can slowly move it one piece at a time and hunt the Trolls into the corners if there are enough Dwarves left. There are eight areas where a decent group of dwarves can form "easily" meaning easier than elsewhere, it's never truly easy. These areas are on the corners where the flat and diagonal sides come together. There is already a group of three Dwarves there so you add to it. Unfortunately, the added Dwarves have to come from somewhere, so the Dwarf player allocates (usually about half) of the corners to be feeds for the other groups. I personally feel that every other corner is a good way to go. Of course, eventually you will want just one group. So anyway, the best opening dwarf move is to get a dwarf from the left side or two corners away to slide to J14. (Since the board is symmetrical, any rotation or mirroring of the moves is of the same strength, so I am just describing one possibility). The best troll response is to go H9 to J10, and threaten the forming group. Now as a Dwarf player, it is good to know when you've lost a group, and you have already lost it. Play some scenarios, and you'll see that if the Dwarf tries to build this group further, a competent Troll player will advance into squares that are not in danger, and destroy many Dwarves and ruin the group. So the Dwarf's second move is to immediately start a new group elsewhere, namely B9, using a dwarf from one of two feed corners. Now this group will succeed marginally better because the Trolls don't have that unbroken shove-line anymore. If the Troll gives up even one move in the tempting pursuit of killing Dwarves that are as yet no threat, the new group can become quite strong indeed. Or if the Troll feels it will help he will kill three Dwarves and ruin the group but lose a Troll in the process. This is a decision that even the best Thud players aren't sure if it is good or not. The game continues from there with each dwarf attempt at making a solid block being slightly more successful than the last IF he abandons failed blocks quickly enough. Eventually a good Dwarf will have slightly more than half his original forces together in block and can go hunting in the end game. If I play Dwarves and Zillions plays Trolls until the block is formed, and then we switch forces, the Dwarf computer is very competent in the end game, it just sucks at getting there. I haven't even mentioned any Troll strategy, but it is a lot easier if you know the Dwarf strategy, and simply try to stop. This is best done by spreading out, as each Troll can command 25 squares. If no Trolls are lost, this can result in almost complete eradication of the Dwarves. Zillions is pretty average at this. My only complaints are that it sometimes doesn't move diagonally when it should to threaten multiple pieces at once, but gets single focused and oddly addicted to orthogonal directions. Also, after a dwarf kills a Troll, the Troll gets a "free move" in which the Troll can decide the area of action rather than the Dwarf for once. Instead of moving into a controlling square where damage can be done to two corners, the Troll usually just opts for revenge and killing the one Dwarf that killed his buddy. As Keith said, the branching factor is high. So I've pretty much given up on it, but if any of you veterans are interested in contiuing my research into Zillions intelligence, I will still gladly discuss ideas with you. If you haven't picked up on it, Thud is like one of my favorite games.
|
|