Beleaguered Castle, solitaire card game

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Beleaguered Castle, solitaire card game

Post by Zax » Wed Nov 08, 2023 2:25 pm

To follow up on this thread, Beleaguered Castle 1.00 is available.

For Mac and windows : https://sw.ixoft.com

The auto-complete function has been greatly improved.
The score calculation has been slightly modified and should be more accurate.
This version also brings some minor graphical improvements.

Although the users preferences and saved games of this version are compatible with previous versions, it may be safer to start a new game right after the first launch.


From the built-in help:
The four aces form the castle's foundations.
All cards start dealt face up and you build down regardless of suit, moving only single cards.
The top card of each row (the exposed card) is available for play either on the foundations or on any other row. If the targeted row is not empty, a sequence has to be built, regardless of suit. Once a row becomes empty, it can be filled by any card.

The game is won when all of the cards are built onto the foundations.

The initial card draw is random, so some games are not winnable but, according to a recent study by Charlie Blake and Ian P. Gent, 68% out of a sample of 2 million games are winnable.

Tips
- Right-click on any card to hilite its available moves.
- Right-click on the board to hilite cards that can be moved onto foundations.
- Hit one of the following key to view the location of all the corresponding cards:
2 3 4 5 6 7 8 9 0 J Q K
- If you are stuck, use the History back and try to find better card movements.
- Click with alt key on the History to go to to the first or last move.
- Try to clear at least one row to have more card movement possibilities. Having 2 empty rows is essential to win a game, as it allows you to significantly modify the remaining piles.

Custom boards can be added. Boards are 256 x 256 pixels jpeg or png image files, located in the Boards folder of the application folder.

Once again, a big thank you to all the members of this forum who made this little game possible. :D
Last edited by Zax on Sat Jul 06, 2024 3:24 pm, edited 1 time in total.

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Fri May 03, 2024 9:02 am

For those who like a challenge, here is one of my most difficult games. I won it in 213 moves, but it's probably possible to do better - you just have to find the right path.

To load this game, launch the application and use the File -> Load menu.

BCastle_Savegame_213.ixp.zip
(882 Bytes) Downloaded 142 times

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 283
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Beleaguered Castle, solitaire card game

Post by SWEdeAndy » Mon Jul 01, 2024 7:32 pm

Zax wrote:
Fri May 03, 2024 9:02 am
For those who like a challenge, here is one of my most difficult games. I won it in 213 moves, but it's probably possible to do better - you just have to find the right path.
Ah, I had missed this challenge, in one of my favourite card games!
Now of course I have to brag! :mrgreen:
So, solved it in 136 moves. It is indeed hard to get on the right opening path. A hint is to get to this stage after 23 moves:
Stage 23.jpg
Getting to two empty slots is (as always) a crucial key to serious re-stacking of the piles.
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.se/en

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 283
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Beleaguered Castle, solitaire card game

Post by SWEdeAndy » Mon Jul 01, 2024 7:51 pm

And of course, my mission had not been complete had I not also unearthed a minor bug! :D
When you load a game from file and then click the auto-complete button, the game claims victory with a rather record-breaking -1 moves! :shock:
Auto-complete bug.png
Fortunately, it doesn't enter the Top 10 list, but still... :)
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.se/en

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 283
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Beleaguered Castle, solitaire card game

Post by SWEdeAndy » Mon Jul 01, 2024 9:41 pm

SWEdeAndy wrote:
Mon Jul 01, 2024 7:32 pm
So, solved it in 136 moves.
Now shaved down to 122 moves. I'll leave it at that! :D
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.se/en

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Tue Jul 02, 2024 12:51 pm

SWEdeAndy wrote:
Mon Jul 01, 2024 9:41 pm
Now shaved down to 122 moves. I'll leave it at that! :D
Very impressive Andreas :D
I'll try, and I'll also take a look at the new weird bug you found.
Thanks for the screens.

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Fri Jul 05, 2024 3:43 pm

SWEdeAndy wrote:
Mon Jul 01, 2024 7:32 pm
Getting to two empty slots is (as always) a crucial key to serious re-stacking of the piles.
Yes, this is the essential condition to win. In fact, although unable to prove it mathematically, I am convinced that a game is always winnable if we manage to free 2 rows.

I just replayed the game posted here and I won it in 119 moves, starting the same way as you.

screen01.jpg
screen02.jpg

Now, regarding the bug you discovered - you are always attentive Andreas! :) - I think this was due to the way the game was saved but I was unable to reproduce the bug.
If the cause is indeed the one I'm thinking of, I don't think I'm going to touch anything because the winnable/won/moves-left process is quite complex - because it was added after the main development - and I would be afraid to do more harm than good by tinkering with it.

Anyway, the next version should fix some minor bugs.

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 283
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Beleaguered Castle, solitaire card game

Post by SWEdeAndy » Fri Jul 05, 2024 8:01 pm

Zax wrote:
Fri Jul 05, 2024 3:43 pm
SWEdeAndy wrote:
Mon Jul 01, 2024 7:32 pm
Getting to two empty slots is (as always) a crucial key to serious re-stacking of the piles.
Yes, this is the essential condition to win. In fact, although unable to prove it mathematically, I am convinced that a game is always winnable if we manage to free 2 rows.
Hmm, yes, maybe - it would be interesting to know if that is so. And also to get a step further - to be able to analyse already from the start if a game is at all winnable. Maybe with some AI assistance... :)
I just replayed the game posted here and I won it in 119 moves, starting the same way as you.
Very well done! It would be cool if a saved game included some kind of id string, that is visible in the playing area. That way it's easier to "prove" with a screenshot that a won game is actually the one shared. Or, to save the verified result to some kind of online scoreboard. :D
Now, regarding the bug you discovered - you are always attentive Andreas! :) - I think this was due to the way the game was saved but I was unable to reproduce the bug.
If the cause is indeed the one I'm thinking of, I don't think I'm going to touch anything because the winnable/won/moves-left process is quite complex - because it was added after the main development - and I would be afraid to do more harm than good by tinkering with it.
Yes, I think you're right about not digging into this bug as it is not easily reproduced - maybe it was a one-off just for the particular game you shared here.

Thanks for your work and continuous development of this strangely addictive solitaire game!
I'll keep playing (and occasionally breaking) it! 8)
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.se/en

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 283
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Beleaguered Castle, solitaire card game

Post by SWEdeAndy » Fri Jul 05, 2024 8:53 pm

SWEdeAndy wrote:
Fri Jul 05, 2024 8:01 pm
And also to get a step further - to be able to analyse already from the start if a game is at all winnable. Maybe with some AI assistance...
Ha, so nerdy me had to dig a little, and voilà, science has us somewhat covered:
https://arxiv.org/pdf/1906.12314

Although the paper doesn't answer the question of the winnability factor for two free cells in Beleaguered Castle, it does conclude that around 68% out of a sample of 2 million games are winnable. :D
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
(WIS_WebDeployHelper, WIS_ScriptDependencies, WIS_BrowserAnimation)
WhenInSpace: https://wheninspace.se/en

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Sat Jul 06, 2024 7:20 am

Ah yes, I would like to know if a game is winnable at the beginning. So, we could add an option to “only display winnable games”.

The technical article you link to is impressive. I notice that my statistics are lower, probably due to the fact that I love playing a game in the morning while having my first coffee: I am sometimes clearly not awake!

ScreenCapture 2024-07-06 à 08.13.28.png
ScreenCapture 2024-07-06 à 08.13.28.png (16.29 KiB) Viewed 449 times

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Sat Jul 06, 2024 3:30 pm

Version 1.30 is available.

Ability to set and load a restauration point added - see Game menu.
Minor bugs fixed.
Although the users preferences and saved games of this version are compatible with previous versions, it may be safer to start a new game right after the first launch.

For Mac and Windows : https://sw.ixoft.com
Last edited by Zax on Tue Jul 09, 2024 8:06 am, edited 1 time in total.

Zax
Posts: 497
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: Beleaguered Castle, solitaire card game

Post by Zax » Tue Jul 09, 2024 8:06 am

Version 1.31 is available.

It fixes a bug concerning the version checking.

For Mac and Windows : https://sw.ixoft.com

Post Reply

Return to “Games”