Stockfish 2.2 IOS source

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Stockfish 2.2 IOS source

Post by whittenizer »

Hey there,

I've shifted focus from WP7 to iPhone for now. I'm putting C# on hold as I'm finding it very difficult to get the performance I desire. Its just the nature of things, and was really expecting much better results.

Anyways, what source is the Stockfish 2.4 for iOS using? I'm guessing its not the Stockfish 2.2 for iOS Source Code, is it? If not, is the 2.4 code released somewhere? What I'd love to do is look at ways to deepen the search in the same amount of time for a given position. If I can currently go to depth 12 in 10000ms, maybe we can get it to go deeper, say depth 14 in the same amount of time.

Anyways, I wish I had gone down this route before but this all was a learning process, and C# ultimately failed in giving me what I need. I do not know iPhone at all so this will be another learning curve but certainly the performance is just awesome.

Thanks for any info.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer »

No one knows where the source lives for IOS 2.4 app? I'd love to grab so I can start playing around with it.

Thanks much
User avatar
Eelco de Groot
Posts: 4561
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Stockfish 2.2 IOS source

Post by Eelco de Groot »

Just my guess but if it is not included with the download on the App store then that would mean Tord has closed the source maybe? I would not be surprised if that were the case, because the iOS Stockfish application was cloned, without source or with slightly changed source but changing the credits and then put up for sale many times and protests had to be filed but some of the clones are for sure still in the store now. Tord has the right to change the license unilaterally, but I don't know if he has done so. If he has not closed the source and the App is still fully GPL it is for sure available from Tord if not included with the App? It is not entirely clear if Apple is not also partly copyright owner of Apps that it sells, programmers like Christophe Théron would know the details of this.

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
User avatar
Eelco de Groot
Posts: 4561
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Stockfish 2.2 IOS source

Post by Eelco de Groot »

The description on the Application store http://itunes.apple.com/us/app/stockfis ... 58605?mt=8
still says
* Complete source code available under the GNU General Public License.
so you would just need to download the App I think? Have you not done so already?

Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer »

If we do not have access to the source for IOS 2.4 app, does anyone know if it based off of the latest SF source? I noticed that the source for IOS 2.2 appears to be based off of maybe SF 2.1.1 or before, at least before the magics were introduced.

Thanks for any info
kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: Stockfish 2.2 IOS source

Post by kinderchocolate »

Only Tord knows the version of the engine, it's highly likely that it's the same version as 2.2.

However that doesn't matter. You can simply copy-and-paste the latest Stockfish sources into the project. It's still C++.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer »

Thanks for the reply. Yeah, I'm just wondering about the CPU cache alignment code. Not sure how that will work for the iPhone. Maybe that stuff was taking out. I'll have to check the iOS 2.2 source and see how that looks.

I may just bring the latest sf source into Xcode and see how it behaves.

Thanks
kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: Stockfish 2.2 IOS source

Post by kinderchocolate »

Note that you have to fix the internal UCI queue before your new engine works.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 11:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer »

Hi,

Yeah, I've only started looking at the source in depth today. I have to wait to actually start working on the code since I don't have a Mac yet to develop on, and I want to use XCode. I'll probably get the Mac mini, something simple.

Anyways, in the meantime, I was hoping you can explain something about the source. There's an "Engine" and a "Chess" folder. Seems like the files in the "Chess" folder were modifed for the iPhone specifically then? I'm not a C++ guy at all as I only really started to learn it for this C++ to C# port so forgive my questions if they seem obvious to a C++ guy. I don't think the latest C++ source can be pasted in without some modification for th eiPhone but I may be wrong.

I'll continue looking at the source to get a better understanding how things work.

Thanks for you emails.
kinderchocolate
Posts: 454
Joined: Mon Nov 01, 2010 6:55 am
Full name: Ted Wong

Re: Stockfish 2.2 IOS source

Post by kinderchocolate »

The Engine folder has the sources for the actual chess engine. Inside it has iphone.mm, which is where you need to look at. In the iOS version, the interface doesn't send the UCI command via process piping, the commands are saved in internal queues defined in EngineController.mm as "commandQueue". The commands are passed to command_to_engine in iphone.mm which directs the inputs to the engine.

The Chess folder has the bitboard implementation. This is necessary for checking invalid moves attempted by the user without sending an illegal move to the engine.

In order for the latest SF to work, actually for any kind of UCI engine to work. You just need to copy the latest SF sources into the Engine folder. Make sure that the handleCommand() function in the new sources are still there. Also make sure when the engine outputs UCI command, you replace the code with making a call to iphone.mm.