Page 2 of 2 FirstFirst 12
Results 41 to 48 of 48

Thread: [RESOLVED] Moving a picture box

  1. #41

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    794

    Re: Moving a picture box

    After reading the previous post I decided on the following:
    This is my version of the game so
    1. The user can decide, in settings, to display time elapsed or not. The game is not limited to 10 minutes.
    2. The undo option has been eliminated.
    3. The user can decide, in settings, to count the moves or not.
    4. The user can decide, in settings, to display a score or not.
    5. The game score is not affected by any of settings above.
    The is scored as follows, only if the user requests scoring:
    A 2 in the correct position = 10 points.
    Each additional card in the same suit and increasing rank based of the appropriate 2 = 5 points each.
    The first complete suite adds an additional 100 points
    The second complete suite adds an additional 200 points
    The third complete suite adds an additional 300 points
    The fourth complete suite adds an additional 400 points.

    Every time the layout changes, shuffle, reshuffle, or valid move, I recalculate the open positions, what needs to be placed there. There are only 4 open positions and a max of 4 correct moves. For this I created an array with the appropriate entries.
    I will let the player move any card, except locked cards. Locked are are primarily strings starting with a 2 in column 1.
    I want the illusion of the card snapping back to the source position if an invalid move. In the mouseDown event I already know if the move if invalid. In the mouseUp event I know if it is valid, not by looking at what card is to the left, but my looking in my new array.

    I have already coded the array and verified the calculations are correct.

  2. #42

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    794

    Re: Moving a picture box

    After reading the previous post I decided on the following:<br>This is my version of the game so<br>1.&nbsp; The user can decide, in settings, to display time elapsed or not.&nbsp; The game is not limited to 10 minutes.<br>2.&nbsp; The undo option has been eliminated.<br>3.&nbsp; The user can decide, in settings, to count the moves or not.<br>4.&nbsp; The user can decide, in settings, to display a score or not.<br>5.&nbsp; The game score is not affected by any of settings above.<br>The is scored as follows, only if the user requests scoring:<br>A 2 in the correct position = 10 points.<br>Each additional card in the same suit and increasing rank based of the appropriate 2 = 5 points each.<br>The first complete suite adds an additional 100 points<br>The second complete suite adds an additional 200 points<br>The third complete suite adds an additional 300 points<br>The fourth complete suite adds an additional 400 points.<br><br>Every time the layout changes, shuffle, reshuffle, or valid move, I recalculate the open positions, what needs to be placed there.&nbsp; There are only 4 open positions and a max of 4 correct moves. For this I created an array with the appropriate entries.<br>I will let the player move any card, except locked cards.&nbsp; Locked are are primarily strings starting with a 2 in column 1.<br>I want the illusion of the card snapping back to the source position if an invalid move.&nbsp; In the mouseDown event I already know if the move if invalid.&nbsp; In the mouseUp event I know if it is valid, not by looking at what card is to the left, but my looking in&nbsp; my new array.<br><br>I have already coded the array and verified the calculations are correct.

  3. #43
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Moving a picture box

    p.s. If you select Edit post, then there should be a selection above the edit window where you can select to delete the post, which you should do for the extra post you made above.

    Quote Originally Posted by AccessShell View Post
    ... There are only 4 open positions and a max of 4 correct moves. For this I created an array with the appropriate entries.
    ...
    I guess your choices seem like a reasonable set of requirements for how you want to implement your version of the game and scoring.

    Hopefully you have a plan to handle the exception to the "only a max of 4 correct moves". The first time a single space appears in the first column you can have up to 7 possible moves to choose from (one of four twos if none have been placed yet, and three other cards in the other spaces (assumes no King to the left of the space). Likewise, if two spaces show up in the first column, and none of the twos have been placed yet, you can have 4 choices for one of the spaces in the first column, and three in the second, plus two more for the other two spaces.

    Granted at any point, you only have four possible positions to put a card, but the first column gives you an exception to the rule that there is only one card, or none, that can go in that space.

    In fact, choosing which two to place in the space that appear in the first column would seem to be the only time in the game that the user can influence the outcome of the game, since which card can go in a space is a fixed single card (or none), so the user has no choice of what card to place in that space. But I guess the order that you choose to move each of those fixed single choice, can influence what is available for the next move, so choosing them in a good order allows a long chain of moves, whereas choosing a bad order can prematurely end the chain, and you have to re-deal.

    Each single move, in spite of being a single fixed choice, can possibly make a difference if one is chosen before the other, so there is a subtle strategy, otherwise the game would seem mostly pointless.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  4. #44

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    794

    Re: Moving a picture box

    I just wanted to let you know where I am with the project.
    I can get to move many picture to the correct locations. I can have picture snap back to the original location (for that move) when the edit fails. However, sometime through the session (no reshuffle yet) a valid move is rejected. I can be the 5th move, or the 7th move, etc. It is not always the same. I have tracked it down to the missing Aces. I think I am not updating one of the arrays properly. I also think it have something to do when I rank up the card value. If the rank is K, I'm not sure where to go. For now I made the rank-up an X. Probably not good.
    Maybe my code is just to complicated?

  5. #45
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: Moving a picture box

    Sounds to me like you are getting closer to your final solution....good job.
    Sam I am (as well as Confused at times).

  6. #46
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Moving a picture box

    Quote Originally Posted by AccessShell View Post
    ... I also think it have something to do when I rank up the card value. If the rank is K, I'm not sure where to go. For now I made the rank-up an X. Probably not good.
    ...
    I wasn't sure what that meant for a bit. I guess what it means is that where the blank is, you are determining the next higher card from the card to its left. The rank up from a K should be an A. Since you shouldn't have any A's available to drag, any card you drag won't match the Ace, so should get rejected.

    In the code you posted (before all this new stuff), where you looped and dealt the cards if the card was an A you didn't add the picture to the picturebox, but you also didn't update the PBLocsArray and strPicArray.
    Perhaps you should have still updated the PBLocsArray and strPicArray, so you know which Ace is there, just not shown, and you know you can't drag it. If your code isn't updating those values in the array to track the blanks, then you're probably leaving old, perhaps duplicate values in your arrays because you don't update them. (But since we don't have the new code, we can't tell).

    Quote Originally Posted by AccessShell View Post
    ...
    Maybe my code is just to complicated?
    You put a question mark at the end of that statement, making it look like a question. But it can't be a question since we don't have any of the new code you're having issues with, so have no way to answer any questions about it.
    So the question mark should just be a period, indicating that you are musing that your code may be too complicated.

    If I had to guess, I would say it is likely complicated.
    Your current card shuffle function (which should be a Sub since it doesn't return a value. You have a number of functions which are really subs) isn't setup so you can reuse it to shuffle the unlocked cards, and the deal isn't setup to deal the cards into unlocked grid spaces.

    You should have been thinking ahead about how you were going to pickup the cards that are not locked, shuffle them, and redeal them into available spaces. Once you had that worked out, you could use those same subs to handle the initial shuffle and deal as well, since it should work when you have 52 spaces available, or any other number of spaces available.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  7. #47

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    794

    Re: Moving a picture box

    Yes, you are correct on all accounts.
    On functions vs subs. I thought that a function must complete before the next line of code after the function was called can execute. When you call a sub the next line of code can continue right away. Maybe that was in a different language I used t write!

    Yes, I did not fully think everything through.

    I just found another issue. When the source is transferred to the destination, it now works 2 ways. I can physically drag the PB. That's what I want. But, I can also click on the source and if there is a place to go, it goes there. I now have to stop that method from happening.

  8. #48

    Thread Starter
    Fanatic Member AccessShell's Avatar
    Join Date
    Oct 2013
    Posts
    794

    Re: Moving a picture box

    I have managed to successfully move the PBs to correct locations. I have successfully determined, in code, when a reshuffle of cards is needed. I have been able to reshuffle properly and move the PBs after a reshuffle. I can now keep score. Just a few more little thing to wrap up.

    I thank you all for your invaluable help. You made this project possible.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width