Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 12-19-2010, 01:17 AM   #106
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Wow, that was all? Thanks, @Surquizu! I hope you enjoy the game.
Now I'm off to see if it will work on my 600!
Ben.
BenChen is offline   Reply With Quote
Old 12-19-2010, 01:52 AM   #107
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Actually, it turned out to be slightly more than that. I had to remove a 'try... catch' in the PRS+ activation script (FreeCell.js). Then it worked fine in my PRS+ 2.0.x custom build:

I changed

Code:
		   try {
			kbook.autoRunRoot.sandbox.getSoValue = Core.system.getSoValue;
			kbook.autoRunRoot.sandbox.hasNumericButtons = Core.config.compat.hasNumericButtons;
			} catch (ignore) {}
to

Code:
			kbook.autoRunRoot.sandbox.getSoValue = Core.system.getSoValue;
			kbook.autoRunRoot.sandbox.hasNumericButtons = Core.config.compat.hasNumericButtons;
Not sure what is going on, but it is now working on my PRS-600.

Thanks,
Ben.

P.S. I've updated the attachment in post #104
BenChen is offline   Reply With Quote
Advert
Old 12-21-2010, 10:29 AM   #108
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 853
Karma: 314486
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
distorted cards-display with PRS-505

Hi,
I just want to report, that Frecell on my PRS-505 shows some distorted cards. You can also notice this in the screenshot in surquizu's post #105. (and yes this is not only due to the jepg-compression of the screenshot)
I'm just currious if this also happens with other eReaders?
BTW: in the Sim there is no distortion!
Attached Thumbnails
Click image for larger version

Name:	2010-12-21-001.jpg
Views:	266
Size:	57.6 KB
ID:	63244  

Last edited by Mark Nord; 01-04-2011 at 01:53 PM. Reason: Removed modified code to be discussed with Ben, see posts below
Mark Nord is offline   Reply With Quote
Old 12-21-2010, 10:57 AM   #109
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
How strange! No, I experience no such distortion on my 600. It looks just like it does in the Sim.
BenChen is offline   Reply With Quote
Old 01-04-2011, 07:52 AM   #110
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
New version of Freecell

Hi everyone,

There's an update to Freecell.

Mark Nord, tracked down the problem with the card distortion on the 505. He also made the digit buttons work on the 500/505 to move the cursor to specific rows.

Mark also suggested that some sort of undo or snapshot facility would be nice. I had the time, so here's a version with a snapshot. Press PREV to open the snapshot and NEXT to save the snapshot.

Sincerely,
Ben.

EDIT: Updated zip file after adding undo with depth of 10 moves. (Note that loading a snapshot resets the undo.) Press the SIZE/ZOOM button to undo the previous move.

UPDATE: Latest version now found in post #145.

Last edited by BenChen; 02-10-2011 at 08:02 AM. Reason: Zip filed move to post #145
BenChen is offline   Reply With Quote
Advert
Old 01-04-2011, 01:36 PM   #111
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Just updated the zip file in the previous post. Freecell now has an undo feature with a depth of 10 moves.
BenChen is offline   Reply With Quote
Old 01-04-2011, 01:44 PM   #112
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 853
Karma: 314486
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
Great Thanks a lot!
Mark Nord is offline   Reply With Quote
Old 01-09-2011, 08:46 PM   #113
surquizu
Evangelist
surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.
 
surquizu's Avatar
 
Posts: 411
Karma: 902071
Join Date: Jun 2008
Location: Zaragoza (Spain)
Device: prs-505, kobo auraHD, kobo auraH2O, kobo Glo HD, kobo aura ONE
Running on my 505 integrated into the PRS + 1.1.3 (small changes in the FreeCell.js)
Thanks.
surquizu is offline   Reply With Quote
Old 01-10-2011, 07:03 AM   #114
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Does anyone know if the Javascript engine used by the PRS readers includes the setTimeout function? I would love to be able to use it, but initial trials in the Test Environment were not successful. (In pure Javascript the function is a method of the window object.)
BenChen is offline   Reply With Quote
Old 01-13-2011, 02:09 PM   #115
Mark Nord
2B || !2B
Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.Mark Nord ought to be getting tired of karma fortunes by now.
 
Posts: 853
Karma: 314486
Join Date: Feb 2010
Location: Austria
Device: Sony PRS505/650/T1/tolino vision 5
Hello Ben,

The "standard-JS" windows-object isn't available to our readers.

But FSK features a <global>Timer
Like used here in Fskin.dialog.autoClick taken from fskin.so
Spoiler:
Quote:
this.Fskin.dialog.autoClick = function (name) {
var button;
if (name in this.sandbox) {
button = this.sandbox[name];
if (button.visible && button.active) {
button.state = 3;
button.invalidate();
this.autoClickTimer = new <global>.Timer();
this.autoClickTimer.onCallback = this.autoClickTimerCallback;
this.autoClickTimer.target = button;
this.autoClickTimer.schedule(250);
}
}
};
this.Fskin.dialog.autoClickTimerCallback = function (delta) {
var button;
button = this.target;
button.state = 1;
button.invalidate();
button.select();
};

I havn't check yet, if Timer is scriptable or had to be addressed in compiled code.
Maybe this can set you on track.
PS: <global> has not to be typed in!
PPS: take care to cancel() and delete the Timer properly, as a active Timer may prevent suspend-mode and thus drain the battery.

Last edited by Mark Nord; 01-13-2011 at 02:29 PM.
Mark Nord is offline   Reply With Quote
Old 01-15-2011, 02:19 AM   #116
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Thanks for that. When I have some more time, I will give it a try.
BenChen is offline   Reply With Quote
Old 01-19-2011, 02:44 AM   #117
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Sorry, Mark, I didn't understand what you meant by "PS: <global> has not to be typed in!"

This is what I have tried so far:

Code:
	this.engineTimer = new Timer();
	this.engineTimer.onCallback = this.engineMove();
	this.engineTimer.schedule(5000);
But it seems this.engineMove() is triggering immediately, rather than after 5 seconds.

What am I doing wrong?
BenChen is offline   Reply With Quote
Old 01-21-2011, 04:14 AM   #118
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
New game: Chess

Hi everyone,

I wanted to see if I could program a Chess game for the Sony Reader. Here's what I have so far. This version only works in 2-player mode. However, it includes castling and en passant, you can choose which piece you get when you promote a pawn, and it automatically detects checkmate and stalemate (although it doesn't detect the 50-move type, just the "while I am not currently in check, there are no legal moves" type.)

Next step, if I have time (and I am not even sure that it is technically possible) is to include AI for a 1 player mode. We'll see..

Hope it works for you. It should work for both Touch and non-Touch readers (although it's pretty painful in non-Touch mode!) I have tested it successfully on my PRS-600.

Sincerely,
Ben.

P.S. Updated to fix graphics issue with non-Touch readers, as well as incorporating Mark Nord's suggestions: buttons 1-8 now move cursor, which is no longer the "hand" icon.

NEW UPDATE:
I have added an initial implementation of Artificial Intelligence! If you press the SIZE button, the reader will make a move for whoever's turn it is. You can therefore play the white pieces, and then press SIZE so that the reader will move for black. Or you can press SIZE so that the reader will move for white, and then you play the black pieces. Alternatively, you can keep pressing SIZE to watch the reader play against itself! Note, though, that there is no automatic mode. You have to press SIZE each time to make an AI move.

The fine print: the AI is not always very good, and it is quite slow. In "Slow mode", AI moves take between 30 and 60 seconds on my 600, and there is no indication that things are happening, so be patient! Also, I have noticed a rather nasty bug: check is not always recognised, or defended against, and the king can even move offensively into check. So if that happens to you, I am sorry! (Although, it can be fun to take the king and watch the game continue!) Since the AI was slotted into place (taken from p4wn on Sourceforge!) I don't think I will be able to track down these bugs... Alternatively, a completely different AI engine could be slotted in at a later stage.

MINOR FIX:
I have found a way to check for checkmate / stalemate no matter who moved last (human or AI), and so it should work in all situations now. (The AI may still move offensively into check, but you'll win as a result!)

I have also changed the default AI speed to "Medium". The AI is good enough and the speed is much quicker than "Slow" mode.

LATEST UPDATE:
I have added an Auto Mode (thanks to code from Kartu!) which is on by default and a 1-level undo feature. The Auto Mode can be turned off using the NEXT button. It will cycle through the AI speeds (Auto On) then the AI speeds (Auto Off), etc. When Auto Mode is On, the reader will move Black. If you want to play the black pieces against the reader, turn the auto mode off, and use the SIZE button to force an AI move when it is White's turn.

As for undo, the Undo button takes the board back to before the latest White move. So this is good for White, not so good for Black. (In other words, if White makes a silly move and Black takes advantage of it, Undo reverts to before White's move. If Black makes a silly move, and then White takes advantage of it, Undo only goes back to before White's move - that is, after Black's silly move.) If people don't like that, I guess I can go back and implement a proper 2-move reversal!

TINY UPDATE: Undo now allows you to continue if your were in checkmate and you press undo.

ANOTHER TINY UPDATE: If you force an white AI move when Auto if On, the reader will now automatically do the Black move as you would expect.

UPDATE: Latest version now found in post #145.

Last edited by BenChen; 02-10-2011 at 08:01 AM. Reason: Zip filed move to post #145
BenChen is offline   Reply With Quote
Old 01-21-2011, 01:36 PM   #119
surquizu
Evangelist
surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.surquizu ought to be getting tired of karma fortunes by now.
 
surquizu's Avatar
 
Posts: 411
Karma: 902071
Join Date: Jun 2008
Location: Zaragoza (Spain)
Device: prs-505, kobo auraHD, kobo auraH2O, kobo Glo HD, kobo aura ONE
Quote:
Originally Posted by BenChen View Post
Hi everyone,

I wanted to see if I could program a Chess game for the Sony Reader. Here's what I have so far. This version only works in 2-player mode. However, it includes castling and en passant, you can choose which piece you get when you promote a pawn, and it automatically detects checkmate and stalemate (although it doesn't detect the 50-move type, just the "while I am not currently in check, there are no legal moves" type.)

Next step, if I have time (and I am not even sure that it is technically possible) is to include AI for a 1 player mode. We'll see..

Hope it works for you. It should work for both Touch and non-Touch readers (although it's pretty painful in non-Touch mode!) I have tested it successfully on my PRS-600.

Sincerely,
Ben.
Do not get it to work in PRS+1.1.3 (PRS-505). Has anyone can?
surquizu is offline   Reply With Quote
Old 01-22-2011, 02:32 PM   #120
BenChen
EPUB Metadata ******
BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.BenChen is not intimidated by interfenestral monkeys.
 
Posts: 525
Karma: 26874
Join Date: Dec 2010
Device: Kobo Glo HD
Quote:
Originally Posted by surquizu View Post
Do not get it to work in PRS+1.1.3 (PRS-505). Has anyone can?
Sorry to hear you are having problems. All I can suggest is do the opposite of what I did in post #107

Change

Code:
		kbook.autoRunRoot.sandbox.getSoValue = Core.system.getSoValue;
		kbook.autoRunRoot.sandbox.hasNumericButtons = Core.config.compat.hasNumericButtons;
to

Code:
		try {
			kbook.autoRunRoot.sandbox.getSoValue = Core.system.getSoValue;
			kbook.autoRunRoot.sandbox.hasNumericButtons = Core.config.compat.hasNumericButtons;
		} catch (ignore) {}
in Chess.js

Sincerely,
Ben.
BenChen is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fsk error, code = -13 Brian Charles Sony Reader 4 04-23-2010 04:21 PM
Fsk error code= -43 shrktank Sony Reader 1 12-24-2009 09:32 AM
Just a silly tweak: AUTORUN.INF for Windows Rootman Kindle Developer's Corner 3 12-04-2009 10:17 AM
Request for test in Windows XP kovidgoyal Calibre 5 08-26-2009 01:14 PM
Windows Develpment Environment issue itimpi Calibre 20 01-17-2009 07:15 PM


All times are GMT -4. The time now is 12:41 AM.


MobileRead.com is a privately owned, operated and funded community.