Stockfish 2.2 IOS source

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
whittenizer
Posts: 85
Joined: Sun May 29, 2011 9:56 pm
Location: San Diego

Stockfish 2.2 IOS source

Post by whittenizer » Thu Mar 22, 2012 6:30 am

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 9:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer » Sat Mar 24, 2012 2:00 pm

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: 4120
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: Stockfish 2.2 IOS source

Post by Eelco de Groot » Sat Mar 24, 2012 2:21 pm

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: 4120
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: Stockfish 2.2 IOS source

Post by Eelco de Groot » Sat Mar 24, 2012 2:40 pm

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 9:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer » Sun Mar 25, 2012 3:52 pm

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: 408
Joined: Mon Nov 01, 2010 5:55 am
Full name: Ted Wong
Contact:

Re: Stockfish 2.2 IOS source

Post by kinderchocolate » Sun Mar 25, 2012 4:01 pm

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 9:56 pm
Location: San Diego

Re: Stockfish 2.2 IOS source

Post by whittenizer » Sun Mar 25, 2012 5:31 pm

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: 408
Joined: Mon Nov 01, 2010 5:55 am
Full name: Ted Wong
Contact:

Re: Stockfish 2.2 IOS source

Post by kinderchocolate » Mon Mar 26, 2012 12:53 am

Note that you have to fix the internal UCI queue before your new engine works.

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

Re: Stockfish 2.2 IOS source

Post by whittenizer » Mon Mar 26, 2012 2:19 am

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: 408
Joined: Mon Nov 01, 2010 5:55 am
Full name: Ted Wong
Contact:

Re: Stockfish 2.2 IOS source

Post by kinderchocolate » Mon Mar 26, 2012 2:42 am

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.

Post Reply