*Author

Scaredgirl

  • Guest
CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401557#msg401557
« on: September 30, 2011, 11:36:41 am »
I've been thinking about the whole discarding/salvaging thing and I really dislike the fact that players get to choose because it means you will never lose a card that you don't want to lose, and winner will always get a card he or she wants. Randomness would be much more fun imo, therefore we now need..

Card Discarder

Here's how it's supposed to work:

1. Insert deck code
2. Choose how many cards you want to discard (drop-down menu)
3. Script outputs forum-ready deck code of a specified number of cards that were randomly picked from the original deck


Here's how it would work in WoE:

1. Loser posts a deck
2. Organizer runs that deck through Card Discarded
3. Organizer posts the "deck" of discarded cards on that same battle result topic
4. Loser discards those cards and winner salvages from those cards. Example: loser discards 12, and the winner salvages 6 out of those 12.


As you can see, it's a pretty simple script. If anyone wants to help out and code something like this, please let me know. The code could maybe used in other events as well. Thanks.

Offline UTAlan

  • Hero Member
  • *****
  • Posts: 1802
  • Reputation Power: 58
  • UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.
  • Immortally Aether
  • Awards: Slice of Elements 9th Birthday CakeSlice of Elements 8th Birthday CakeSlice of Elements 7th Birthday CakeWeekly Tournament WinnerSlice of Elements 6th Birthday CakeReviver of the WikiWar #6 Winner - Team AetherSlice of Elements 3rd Birthday CakeSecond Budosei of BudokanSlice of Elements 2nd Birthday CakeWeekly Tournament Winner
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401575#msg401575
« Reply #1 on: September 30, 2011, 12:27:26 pm »
Super simple. I'll work on this and post when I have something for testing.

Offline Xenocidius

  • Legendary Member
  • ******
  • Posts: 2696
  • Reputation Power: 49
  • Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.Xenocidius is towering like an Amethyst Dragon over their peers.
  • Fear the Darkness ...
  • Awards: Slice of Elements 3rd Birthday CakeFavorite Community Member of 2011Weekly Tournament WinnerWinner of Design a Competition Competition
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401578#msg401578
« Reply #2 on: September 30, 2011, 12:34:46 pm »
Wow, that is a super simple script. I'll let UTAlan do it though, rather than start a coding war ... ::)
Don't cry because it's over, smile because it happened.

Offline UTAlan

  • Hero Member
  • *****
  • Posts: 1802
  • Reputation Power: 58
  • UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.
  • Immortally Aether
  • Awards: Slice of Elements 9th Birthday CakeSlice of Elements 8th Birthday CakeSlice of Elements 7th Birthday CakeWeekly Tournament WinnerSlice of Elements 6th Birthday CakeReviver of the WikiWar #6 Winner - Team AetherSlice of Elements 3rd Birthday CakeSecond Budosei of BudokanSlice of Elements 2nd Birthday CakeWeekly Tournament Winner
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401584#msg401584
« Reply #3 on: September 30, 2011, 12:51:23 pm »
Card Discarder (http://elements.alanbeam.net/discarder.php)

Feedback welcome.

Offline Jappert

  • Legendary Member
  • ******
  • Posts: 2311
  • Country: nl
  • Reputation Power: 27
  • Jappert is a proud Wyrm taking wing for the first time.Jappert is a proud Wyrm taking wing for the first time.Jappert is a proud Wyrm taking wing for the first time.Jappert is a proud Wyrm taking wing for the first time.Jappert is a proud Wyrm taking wing for the first time.
  • New to Elements
  • Awards: War #4 - Sportsmanship AwardVery Short Story: Who are the Elders? WinnerThe Binder of Elements (Forum Profile Deck Winner)
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401618#msg401618
« Reply #4 on: September 30, 2011, 02:18:34 pm »
I agree with the idea. Everyone would just salvage rares/uncommons and noon would dicard them (got my 3 BH's anywayz!)

They are uncommon or rare for a reason!

Offline bored_ninja777

  • Hero Member
  • *****
  • Posts: 1080
  • Reputation Power: 13
  • bored_ninja777 is taking their first peeks out of the Antlion's burrow.bored_ninja777 is taking their first peeks out of the Antlion's burrow.
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401621#msg401621
« Reply #5 on: September 30, 2011, 02:25:32 pm »
seems nice.. wish i had a chance to do the coding, i could use the practice but alas i would not know where to start? all php then im at a loss i never learned that language..
as far as how it works it seems just fine. only thing i noticed was the url takes all of your deck code and plops it in there when you hit the button. so maybe have it not do that if possible?
~McPasty was here~

Offline UTAlan

  • Hero Member
  • *****
  • Posts: 1802
  • Reputation Power: 58
  • UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.
  • Immortally Aether
  • Awards: Slice of Elements 9th Birthday CakeSlice of Elements 8th Birthday CakeSlice of Elements 7th Birthday CakeWeekly Tournament WinnerSlice of Elements 6th Birthday CakeReviver of the WikiWar #6 Winner - Team AetherSlice of Elements 3rd Birthday CakeSecond Budosei of BudokanSlice of Elements 2nd Birthday CakeWeekly Tournament Winner
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401622#msg401622
« Reply #6 on: September 30, 2011, 02:27:46 pm »
only thing i noticed was the url takes all of your deck code and plops it in there when you hit the button. so maybe have it not do that if possible?
The advantage to leaving that in the url is that you can link to the page with the deck code already loaded in. Less important for this tool since the cards would be randomized again, but doesn't hurt anything to leave that option there, either.

Offline bored_ninja777

  • Hero Member
  • *****
  • Posts: 1080
  • Reputation Power: 13
  • bored_ninja777 is taking their first peeks out of the Antlion's burrow.bored_ninja777 is taking their first peeks out of the Antlion's burrow.
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401624#msg401624
« Reply #7 on: September 30, 2011, 02:31:31 pm »
only thing i noticed was the url takes all of your deck code and plops it in there when you hit the button. so maybe have it not do that if possible?
The advantage to leaving that in the url is that you can link to the page with the deck code already loaded in. Less important for this tool since the cards would be randomized again, but doesn't hurt anything to leave that option there, either.
i see, could you pm me details on how you  went about doing this? where created it etc. so i could possibly try to make one for fun and practice? the logic is simple but i never used php before so couldnt hurt to try.
~McPasty was here~

Offline Kuroaitou

  • Legendary Member
  • ******
  • Posts: 4662
  • Country: us
  • Reputation Power: 82
  • Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.Kuroaitou is a mythical and divine giver of immortality, one of the Turquoise Nymphs.
  • Awards: Slice of Elements 10th Birthday CakeSlice of Elements 9th Birthday CakeSlice of Elements 8th Birthday CakeMaster of Mafia10th Trials - Master of TimeSlice of Elements 7th Birthday CakeSlice of Elements 6th Birthday CakeSilver DonorSlice of Elements 5th Birthday CakeSlice of Elements 4th Birthday CakeSlice of Elements 3rd Birthday CakeSlice of Elements 2nd Birthday CakeWeekly Tournament Winner
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401627#msg401627
« Reply #8 on: September 30, 2011, 02:41:03 pm »
Card Discarder (http://elements.alanbeam.net/discarder.php)

Feedback welcome.
Fairly clean overall, and hopefully we can have a trusted organizer to reliably do this for the battles. (Actually, the 'battle' organizer would be best suited for this task anyway ;) ).

I can't seem to spot any problems with it; perhaps the only suggestion I can think of is a "generated word list" that writes the cards out that are being discarded, but even then, it doesn't seem that big of a deal. ^^ Nicely done UT.

Scaredgirl

  • Guest
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401680#msg401680
« Reply #9 on: September 30, 2011, 04:44:39 pm »
Card Discarder (http://elements.alanbeam.net/discarder.php)

Feedback welcome.
Looks great. Thanks.

It works like that but it would be super cool to have the tool generate the forum code as well, so that the organizer can just copy-paste everything. So instead of giving us only the code, it would give something like this:

Code: [Select]
[color=#e8cf77][i][font=georgia][size=36pt]Discard & Salvage[/size][/font][/i][/color]
[deck author=                LOSER DISCARDS ALL OF THESE, WINNER SALVAGES FROM THESE]55t 58o 58o 595 5v0 5v0[/deck]
Discard & Salvage
Code: [Select]
55t 58o 58o 595 5v0 5v0
You think you could something like that? And if you start customizing, you could also remove that mark code button since we won't be needing that mark code in WoE discarding/salvaging.

It's of course a good idea to keep that original tool intact, in case other events use it.



I also have a tiny bug report.

"Mark In Code" checkbox breaks down after first use if the first use in unchecked. What it does is it rechecks the box, but it still functions as unchecked. In other words, if your second Submit is you trying to see the deck with the mark, you have to uncheck the box.

Offline UTAlan

  • Hero Member
  • *****
  • Posts: 1802
  • Reputation Power: 58
  • UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.UTAlan is truly a Titan, worthy of respect and acknowledgement.
  • Immortally Aether
  • Awards: Slice of Elements 9th Birthday CakeSlice of Elements 8th Birthday CakeSlice of Elements 7th Birthday CakeWeekly Tournament WinnerSlice of Elements 6th Birthday CakeReviver of the WikiWar #6 Winner - Team AetherSlice of Elements 3rd Birthday CakeSecond Budosei of BudokanSlice of Elements 2nd Birthday CakeWeekly Tournament Winner
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401708#msg401708
« Reply #10 on: September 30, 2011, 05:49:08 pm »
It works like that but it would be super cool to have the tool generate the forum code as well, so that the organizer can just copy-paste everything.
This is done. I added a "Format Output (WoE)" checkbox that will format it as you request if checked, output just the code if not.

Quote
And if you start customizing, you could also remove that mark code button since we won't be needing that mark code in WoE discarding/salvaging.
I went ahead and removed the mark code and show image checkboxes. I'm defaulting the show image checkbox to yes, while I am now actually checking to make sure the last code in the deck is a mark code - truncating it if it is, doing nothing if it is not.

Quote
"Mark In Code" checkbox breaks down after first use if the first use in unchecked. What it does is it rechecks the box, but it still functions as unchecked. In other words, if your second Submit is you trying to see the deck with the mark, you have to uncheck the box.
No longer an issue since I removed that checkbox. Not an issue with the new Format Output checkbox.

Scaredgirl

  • Guest
Re: CODING PROJECT: Card Discarder https://elementscommunity.org/forum/index.php?topic=31746.msg401715#msg401715
« Reply #11 on: September 30, 2011, 06:16:44 pm »
Perfect. Exactly what I wanted. Thanks!

 

anything
blarg: