ChessBall

Hydroque’s profile indicates 4 years of coding experience, ags1’s 7 years.
Just sayin’ ;D

If-else statements aren’t “go on to the rest”, they’re “if this happens do this, otherwise do that”, and not “if this happens do this, then do that”.

You’re right that switch is faster, but only after a certain number of elements (in C# it is five elements or more) does the switch become optimized into a lookup table or hash list. Any fewer than that and the switch is a glorified if-else-if statement.

Micro-optimizations like these are what they say: micro. Premature optimization is the root of all evil! Work on the big picture, such as not brute forcing your AI to try to find the best result out of computing hundreds of thousands of results.

Re-read my profile.

You can argue the semantics of what if-else is all you want. I am talking about the use of them. You should find someone else to argue this with.

Are you seriously arguing over switch vs if-else?

If your performance tuning is that specific then you should definitely not be using Java.

Even if there is a little performance boost, i don’t think it is noticeable on todays machines.
Also the AI in this game takes a few minutes to calculate the step and this optimization won’t give you more then a few seconds, which won’t be noticeable for a user who wants to play the game.
So IMHO it is better to choose the easiere-to-read-solution.

Yeah am my way looks pretty too :smiley:

Back to topic :wink:

I updated the website. Now you can find a description how to create your own ai. :wink: If someone is interested, that would be cool :wink:

A new Version is uploaded too.

  • I removed several bugs
  • I “pimped” the demo mode
  • I added a puzzle mode. In that mode you get a specified start formation and have to score in one turn. The goal is that the player learn to score and see the possibilites
  • removed serval bugs
  • the ai “talks” more while thinking

Next steps

  • update the android version too
  • better and faster ai :wink:

I have a feeling this AI is turning into “that one thing you know you have to do to make your project work but you don’t want to do it now so you’ll just do it at the very end” :point:

Yes and no. I started the ai at the beginning. Now the ai is about 15 to 20 times faster and stronger too. But it is also too slow. I need a strong and fast ai. So I try to make it better from version to version.

A new version is online.

Thats new:

  • the ai makes no senseless moves.
  • the ai is faster. [unnecessary objects removed, faster goal recognition, better heuristic]
  • removed many bugs. I am suprised HOW many bugs such a small project could have …

Next steps:

  • update the android version and the publish it on the playstore
  • more and harder puzzlelevel

Avoid saying black’s and white’s, especially without an apostrophe.

People will inevitably tie it back to racism. Try, “Your Turn” and “Opponent’s Turn” or “Enemy’s Turn”

Really neat change on chess mechanics. I would recommend the ball being kicked to where i choose to send it. It seems to just teleport there unlike the AI’s kick movement.

I reckon it should technically be [icode]blacks’[/icode] and [icode]whites’[/icode]. But you are right, it does sound racist now that you pointed that out :persecutioncomplex:

Not that it is directly racist, but do you really want childish people to have the room to…?

Today I decided to publish it in the playstore. But of course I will develop the game further.

In the new version I added:

  • a new easy ai which dont need much time to choose its turn
  • more puzzles
  • removed the last (known) bugs :smiley:

And I made a little trailer

SGsYjD0pUZQ

Now there is an apostrophe after whites and blacks. It wasnt my aim to “sound racist”. It is a game and there are black and white figures …

I will add it in the next version.

I thought I am ready with that game, but a developer is never ready with a game. :wink:

I publish a new version:

  • Pawns “transform” to Queens when they reach the end of the board
  • a new options menu where you can choose if white is playing from up to down or down to up
  • the puzzles will be saved and you see which puzzles you’ve solved (only android version)
  • a new “pause menu”: when you press the menu button ingame a pause menu will come where you can choose if you want to restart, go to the main menu or go back to the game.

Next step:

  • I thought it would be easy but it isnt. I have to change more code than I tought, so it will be implemented in the next version.

Shouldn’t the player be able to choose between queen/knight/rook/castle? I reckon changing into a knight could be useful in some very specific situations :slight_smile:

You are right. You should be able but in ChessBall I only implement the queentransformation. The reason is I want to load old replays and when the player can choose which figure it should be I had to modify to much code. So I decided that way. :wink: But perhaps I found some time to implement and test it.

New version is online

What is new

  • smartphone back-button works now in all menus (android version)
  • in the options menu you can choose, whether you want to drag your figures directly or like the ai (was a wish by Jervac)
  • more puzzles
  • removed bugs

How fast does android do the calculations apart from computer?