How to change card order of cards (numbers)?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: How to change card order of cards (numbers)?

Post by [-hh] » Mon Jun 06, 2016 2:52 pm

Your code for a "swapAC" is exchanging the "childs" of A and C.

Isn't the OP's question to simply reorder the cards (while preserving the childs) according to a new sort order for the 'groups' A,B,C and D? At least his last example does that ...
shiftLock happens

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: How to change card order of cards (numbers)?

Post by Newbie4 » Mon Jun 06, 2016 3:17 pm

It is confusing because we are dealing with 2 different people.

If you look at the first post (samjith). A starts out with 3 cards and C has 5 cards. After the swap, A has 5 cards and C has 3 cards. So the cards are actually swapped from one letter to another.

He seems to verify that in his follow-up posts. If you look at the examples, C's 5 cards are now at the beginning and referred to as A's cards. So I assumed he wanted them renamed from "C-#" to "A-#" Sometimes it is confusing to figure out what a user is actually wanting to do. Languages and terminology get in the way.

I may be wrong. Hopefully Samjith will get back to us with confirmation or clarification. You did give a nice and complete answer to him. Good job. And thanks for bringing up the difference in our interpretations. Hopefully one of us answered his question and we can put this posting to rest.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: How to change card order of cards (numbers)?

Post by [-hh] » Mon Jun 06, 2016 3:48 pm

It was the biggest and hardest part of this thread to clarify what the two OP's want.
Now, wouldn't it be a good idea (if you find some time) to complete your code, so that other beginners who read this thread have the solutions to both of the questions?
shiftLock happens

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: How to change card order of cards (numbers)?

Post by Newbie4 » Mon Jun 06, 2016 4:14 pm

It is a fine line between us writing the code for them and pointing them to the way to do it themselves. I prefer the second way so that they gain from the learning experience. From time to time, we get posts from students who just want the code written for them. Our job is not to do their homework for them but to help them learn.

Another reason not to be too specific with code is that we all have our own naming conventions and programming habits. What may seem simple and straight forward to you may be confusing to someone else. You might use a lot of functions while another prefers straight-line code. You might program a more general case with lots of variables and input fields while someone else just wants the code for their specific case.

Looking at his code from an earlier post, he/she knows how to use fields and pick off chars from input. What I left was certainly do-able by the author of this post.

Besides, we are still unclear about what he wants/needs. To write specific code may mislead him/her and lead to another volley of explanations and questions. If he/she still needs help with the code, we are here. Until then, there is enough here to get them further.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Re: How to change card order of cards (numbers)?

Post by samjith » Tue Jun 07, 2016 5:10 am

Hi guys,

I am very happy, because i expect one answer, but i got more.

Actually i need
A-1
A-2
A-3
B-4
B-5
C-6
C-7
C-8
etc.
this type. but Klaus suggest me to do
Hint:
A clever naming scheme often make things easier to handle.
So can you please NAME your cards like:
A_1
A_2
A_3
B_1
B_2
etc.

And then explain again what you are trying to do with these NAMES in a little example?


Best

Klaus
like this, that's generates the confusion.
i made the code so much complicated by repeat loops, etc.
But now i got it. thanks for the job. I didn't think about the sort command.

Thanks

Samjith

Post Reply