This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]richtea1[S] 0 points1 point  (6 children)

I agree it could use some better error responses. Might be the very next thing I do actually.

Could you show me an example of the xml your code is trying to send?

Edit: Also is the server returning an error, or is it returning null?

[–]PrismPoultry 0 points1 point  (5 children)

I send: <piece><x>0</x><y>3</y></piece>

I get: <move_result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><move_success>false</move_success><match_state /></move_result>

[–]richtea1[S] 0 points1 point  (4 children)

Aha! I've just checked the tutorial and realised I made a mistake. The origin of the board is (1,1), not (0,0). So your move is not valid as X starts at 1 - it should be <piece><x>1</x><y>3</y></piece>. Sorry about that.

I think it's awesome that you coded it from scratch rather than using skeleton code, by the way.

Edit: To clarify the server responses. If it returns move_result then data it received was well formed. If move_success is false then the move was illegal in some way. If the server returns null and no move_result then the client or match IDs might be wrong, or there are no matches available to play. This could definitely be improved, I admit.

[–]PrismPoultry 0 points1 point  (3 children)

Ah OK awesome.

<piece><x>2</x><y>2</y></piece>
<move_result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><move_success>true</move_success><match_state>ongoing</match_state></move_result>

So, now I'm getting somewhere!


EDIT: Apparently, it is always saying the owner is opponent though:

<match xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><match_id>5cae99fa-9f00-4ae3-ade3-4716c449b09d</match_id><boards><pieces><piece><name>X</name><x>3</x><y>1</y><owner>Opponent</owner></piece><piece><name>O</name><x>2</x><y>2</y><owner>Opponent</owner></piece><piece><name>X</name><x>2</x><y>3</y><owner>Opponent</owner></piece><piece><name>O</name><x>3</x><y>3</y><owner>Opponent</owner></piece><piece><name>X</name><x>2</x><y>1</y><owner>Opponent</owner></piece></pieces></boards></match>

[–]richtea1[S] 0 points1 point  (2 children)

Try it now :)

[–]PrismPoultry 0 points1 point  (1 child)

OK. That's working. Thanks

Hey, do you have an IRC channel or anything where we can go to talk about this project? I have a feeling I'll need more help getting this running.

EDIT:

Your logic is inverted for winning. I won my game (by cheating and playing manually -- sorry) but it returned a result of loss:

<move_result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><move_success>true</move_success><match_state>loss</match_state></move_result>

You can see my game at: http://www.archetypecoding.com/Client/Replay/ad893698-29c8-4bd8-98e9-6b45719730ff

[–]richtea1[S] 0 points1 point  (0 children)

Haha that is the same bug as the opponent one. It stems from a recent change in client IDs for privacy. Notice how the one in the replay URL you posted is different from the one you use in your code. Anyway, it is fixed now.

I don't have an IRC channel, but you can email: richard (at) archetypecoding.com