Create a button's icon with a part of a big image? - Beleaguered Castle
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
0.20 is out.
The real cause of the main bug is still not found, but this bug does not cause a problem if you don't click too quickly on the cards or on the history.
Some sounds have been added.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 20_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 20_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
The real cause of the main bug is still not found, but this bug does not cause a problem if you don't click too quickly on the cards or on the history.
Some sounds have been added.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 20_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 20_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
I like the sound effects you've added, unobtrusively marking the start and end of a game.
Two things I've noticed:
- The auto-move of a card when clicking it is sometimes "dumb". Example: Clicking on a 2 can send it to the top of a three in the side stacks, instead of the obvious move to the ace. I would expect the first priority of the code that checks where a card can go to check if the suit's middle pile is available, and if not then check if it can go on a side stack, and as last option to an empty slot.
- The resize of the cards when building a tall side stack still happens too soon, when there is still room for 4-5 more cards on the stack without the top card touching the edge of the playing area. And after a resize, if you manually enlarge the app window to make the playing area bigger, expecting the cards to enlarge too, the cards instead resize to even smaller!
Nevertheless, I enjoy this game very much. My current record is now 67 moves, and I still ache for that simple local highscore (or lowscore ) list to keep track...
Two things I've noticed:
- The auto-move of a card when clicking it is sometimes "dumb". Example: Clicking on a 2 can send it to the top of a three in the side stacks, instead of the obvious move to the ace. I would expect the first priority of the code that checks where a card can go to check if the suit's middle pile is available, and if not then check if it can go on a side stack, and as last option to an empty slot.
- The resize of the cards when building a tall side stack still happens too soon, when there is still room for 4-5 more cards on the stack without the top card touching the edge of the playing area. And after a resize, if you manually enlarge the app window to make the playing area bigger, expecting the cards to enlarge too, the cards instead resize to even smaller!
Nevertheless, I enjoy this game very much. My current record is now 67 moves, and I still ache for that simple local highscore (or lowscore ) list to keep track...
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Thanks for your report Andreas.
I'll check the auto-move, and I'll try to improve the resize.
67 moves is a great score, gratz
Displaying igh scores is quite easy to manage. I'll add this feature soon.
I'll check the auto-move, and I'll try to improve the resize.
67 moves is a great score, gratz
Displaying igh scores is quite easy to manage. I'll add this feature soon.
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
I actually have a few days to update the app.
Given the following items:
What do you think is the fastest way to know if the first part of the items form a descending sequence?
So, somethink like the following items will be OK:
Given the following items:
Underscore is the delimiter fore ach item.13_2,12_1,11_1,10_4,9_2,8_1,7_3,6_2,5_4,4_2
What do you think is the fastest way to know if the first part of the items form a descending sequence?
So, somethink like the following items will be OK:
But these one are not OK:13,12,11,10,9,8,7,6,5,4
I have several ideas of how to make it slowly, but the speed is really the most important criteia. Maybe it wll be faster with regex?13,11,12,10,9,8,7,6,5,4 -- bad order
13,12,11,10,10,9,8,7,6,5,4 -- duplicated value
13,12,11,9,8,7,6,5,4 -- missing value
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Don't think regex would help re-order your list, which is the main issue (missing or extra entries can be picked up instantly with 'number of items').
Actually i'm wondering why you don't just use an array for this instead of a hybridised list with each item being a couplet of values, which complicates things?
If you want to stick with the list i would suggest using a space instead of an underscore, so that you can sort by word 1 of each item.
There's no reason why your source list couldn't be 13 2,12 1,11 1,10 4,9 2,8 1,7 3,6 2,5 4,4 2 is there?
example:
tCards now contains 13 2,12 1,11 1,10 4,9 2,8 1,7 3,6 2,5 4,4 2
If you want to check if the order is really a descending order in your source list, you can put this into a variable, sort the variable as above and if (tSource = tCards) is false, you'll instantly know the order was wrong...
HTH
S.
Actually i'm wondering why you don't just use an array for this instead of a hybridised list with each item being a couplet of values, which complicates things?
If you want to stick with the list i would suggest using a space instead of an underscore, so that you can sort by word 1 of each item.
There's no reason why your source list couldn't be 13 2,12 1,11 1,10 4,9 2,8 1,7 3,6 2,5 4,4 2 is there?
example:
Code: Select all
put"6 2,13 2,11 1,10 4,9 2,12 1,8 1,7 3,5 4,4 2" into tCards
sort items of tCards descending numeric by word 1 of each
If you want to check if the order is really a descending order in your source list, you can put this into a variable, sort the variable as above and if (tSource = tCards) is false, you'll instantly know the order was wrong...
HTH
S.
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Reordering is not the issue here, as the sequence represents the actual order of cards in a pile (if I'm not mistaken).
Comparing a sorted sequence with the source doesn't work either, as this would not catch duplicates.
Here's what I would do:
The function only needs to loop until it finds a "sequence-breaker", unless the whole pile is actually in sequence.
I think it works correctly, even with just one value as source, if one card is to be considered a "sequence". It's not a non-sequence at least...
Comparing a sorted sequence with the source doesn't work either, as this would not catch duplicates.
Here's what I would do:
Code: Select all
function checkSequence pSource
replace "_" with space in pSource
repeat with i = 1 to the number of items of pSource -1
if word 1 of item i+1 of pSource is not word 1 of item i of pSource -1 then return false
end repeat
return true
end checkSequence
I think it works correctly, even with just one value as source, if one card is to be considered a "sequence". It's not a non-sequence at least...
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Hi Andy,
Zax's post suggests that's not the case, and that he's looking for descending order:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Thanks for your quick answers
I try to test if the game is won. Such a game can be considered as won:
Andreas' function does the job.
Yep.
I try to test if the game is won. Such a game can be considered as won:
Andreas' function does the job.
It was a choice made at the very beginning, but I defined the delimiter as a global, so I can change it if it's not a good choice.
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
0.31 is out.
Lots of optimizations and small bug fixes. The weird bug caused by too fast clicks is still present but occurs much less frequently. In addition, the repair of the board in the event of an error is more efficient.
Statistics and high-scores added.
Concerning "dumb" auto-moves, this also happened to me sometimes but I don't understand where the error comes from: I checked the algorithm and it is correct.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 31_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 31_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
Lots of optimizations and small bug fixes. The weird bug caused by too fast clicks is still present but occurs much less frequently. In addition, the repair of the board in the event of an error is more efficient.
Statistics and high-scores added.
Concerning "dumb" auto-moves, this also happened to me sometimes but I don't understand where the error comes from: I checked the algorithm and it is correct.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 31_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 31_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Cool!
But what happened to the card deck called "Default"? I liked that artwork more than the current "Classic" and "Castle special".
The statistics look great, but I experience some bugs: After playing 6 games and winning one, the stats said I had won 3. Then after several failed attempts, I won a second game; the stats still say 3 won, and the Top 10 list appears to be a Top 1 list. Except my last win had a better score than the one on the list...
Since the date at the top seems a bit random, I suspect there's some kind of old prefs stored somewhere, that need to be reset? But I can't find any? How do you store the stats?
When repairing the board, the count is reduced to 0 (logic, since the move history is cleared). But have you taken measures to save the move count value, so that if winning the game, the correct number of moves is summed? I haven't been able to test this yet, so just a thought.
But what happened to the card deck called "Default"? I liked that artwork more than the current "Classic" and "Castle special".
The statistics look great, but I experience some bugs: After playing 6 games and winning one, the stats said I had won 3. Then after several failed attempts, I won a second game; the stats still say 3 won, and the Top 10 list appears to be a Top 1 list. Except my last win had a better score than the one on the list...
Since the date at the top seems a bit random, I suspect there's some kind of old prefs stored somewhere, that need to be reset? But I can't find any? How do you store the stats?
When repairing the board, the count is reduced to 0 (logic, since the move history is cleared). But have you taken measures to save the move count value, so that if winning the game, the correct number of moves is summed? I haven't been able to test this yet, so just a thought.
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
File -> Reset PreferencesSWEdeAndy wrote: ↑Fri Oct 07, 2022 7:16 pmAfter playing 6 games and winning one, the stats said I had won 3. Then after several failed attempts, I won a second game; the stats still say 3 won, and the Top 10 list appears to be a Top 1 list. Except my last win had a better score than the one on the list...
Since the date at the top seems a bit random, I suspect there's some kind of old prefs stored somewhere, that need to be reset? But I can't find any?
In fact, I should have forced a reset of the preferences during the first launch of 0.3x version.
Concerning a "repaired" game, you are right: I forgot to manage the case in the statistics. I'll see what can be done in the next version.
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Ah, I had missed that menu option!
OK, I've reset prefs, played a few games and then won one. My stats are now eh... amazing...
Not that I want to spoil such a legendary winning ratio, but nevertheless looking forward to v0.32...
Oh, one more thing: After an auto-resize by the game, the set now correctly resizes up again when manually enlarging the window. But it doesn't stay that way. As soon as the next move is done, it goes back to (too) small again.
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
You're too good for the game, Andreas!
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
0.32 is out, thanks to Andreas.
Statistics bug should be fixed.
"dumb" auto-moves fixed.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 32_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 32_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
Statistics bug should be fixed.
"dumb" auto-moves fixed.
Mac OS: https://sw.ixoft.com/files/_OLD/Beleagu ... 32_OSX.zip
Windows: https://sw.ixoft.com/files/_OLD/Beleagu ... 32_win.zip
Linux: https://sw.ixoft.com/files/_OLD/Beleagu ... inux64.zip
-
- VIP Livecode Opensource Backer
- Posts: 261
- Joined: Sat Aug 16, 2008 9:48 am
- Location: Stockholm, Sweden
- Contact:
Re: Create a button's icon with a part of a big image? - Beleaguered Castle
Unfortunately, it seems not. I deleted the previous version, installed the new one, saw that the stats were reset but did a manual reset anyway to be really sure. Then played 4 games that I had to give up. Stats looked correct so far.
Then I won one game, and the stats say I won 8 games (again), and have 160% won games...
Are the prefs/stats saved to a text file or similar somewhere?
Another bug: When using Check for updates, and there is one, the link to the download page is incorrect and gives a 403 error on your site. So the only way to get the latest version is currently here in this thread.