Closed JonZarate closed 6 years ago
Hi Jon, thanks for bringing this up! The hasWon endpoint was definitely not working due to a bug. This should be fixed now with this commit, you can use this endpoint with curl:
curl 'http://kevinalbs.com/connect4/back-end/index.php/hasWon?board_data=0002000001102000222100012220002111000000000000000&player=2&i=3&j=3'
This should return the string "true". Let me know if this fixes it for you.
Thanks to you for sharing this with us ! :D
You were not using this endpoint in your web demo, right?
You're very welcome :) If you are considering using the API for a project I'd love to hear more about it!
And correct, the web demo has a separate Javascript function to check for a win condition here. I think the reason I did not use the hasWon endpoint was to get the list of the four winning pieces, but the hasWon endpoint only returns "true" or "false". In retrospect, the hasWon endpoint should return more information. I would be open to updating the hasWon endpoint when I have time or accepting a pull request if this is something you'd need.
I am developing a sample Xamarin Android project for the newcomers in my current company. It's meant for them to have an app to learn from :D
Amongst all the things it will have, I decided I would use your endpoints to make a simple game and show how to create custom components, handle communication etc. I am also using a Chuck Norris jokes public API hahaha
It would definitely come handy to have a list of the connected discs ! Unfortunately, I am not into web development, so I cannot contribute at the moment :(
Thanks again for the fix! It's working when the Ai wins, can test the opposite scenario tho, I am not able to beat it hahahaha
Haha that sounds great! I wish I had known about the Chuck Norris jokes API before.
I created another issue to add more return data to the hasWon endpoint https://github.com/kevinAlbs/Connect4/issues/2 to track this work. When I get a chance to work on it, I'll update that issue.
Feel free to create other issues or reach out to me over email (listed here).
I cannot connect to hasWon endpoint. Were changes made to the source code ?