Sniff is a "Scratch-like" programming language that's designed to help Scratchers move gently from Scratch to more conventional languages. They can start writing programs, without having to learn a new language because Sniff is based on Scratch. They learn a little more about variables, compiling, syntax errors (!), and they can have fun controlling real hardware while they're doing it.

Tuesday, 2 May 2017

Pokemon TCG: Greedy Dice

Pokemon have been quite a thing in the Sniff household for the last year or two (before "Go" and Sun and Moon made them trendy again), but a recent expansion has been into the Trading Card Game. For those who haven't played, its a card game played with Pokemon cards. However while the basic game is reasonably fun, what makes it interesting is that you can choose what cards make up a your deck. When you get ripped off at Asda's for a "booster pack" it provides 10 new cards, which you can use to replace  cards previously in your deck. Generally you can think of it as a giant game of rock paper scissors, where some cards are better than others, but even some of the weaker ones can come into their own under the right circumstances, so picking the right cards to use is critical.

One card such card is called "Greedy Dice". Within the game there is a pile of 6 "prize" cards, dealt randomly from your deck at the start of the game. Each time you knock out an opponent you get a prize card from your own pile, and if you get all 6 you win! The rule for greedy dice is, if its drawn from the prize pile, you toss a coin and if its heads you get to take another prize card! Two for the price of one!

However once you actually think about it, is it really such a great card to have in your deck? You're limited to 60 cards, so if you put a GD card in, you need to take something out, so you need to be pretty sure its worth it.

So lets do the maths... from 60 cards you have a 1 in 10 chance that one of the 6 prize cards is the GD card. So you'll get something good 1 game in 10? Well not so fast... there are six prize cards, but GD is only useful if one of the first 5. Getting to take an extra prize card does'nt' really help if you've already won. Worst, we forgot about the coin toss, so we get a benefit less than 1 game in 20.

OK that's a bit pointless, but what if we go for it! You're allowed to have up to 4 of each card in your deck, so what happens if we put 4 of them in. That's a big chunk of deck space, but hopefully we'll start to get something out of it...

Now the maths gets a bit more complex, so lets write a program:

make cardsInDeck number 60
make cardsInPrizes number 6
make greedy number 4

make cards list of boolean
make prizes list of boolean



So here we've got 60 cards in a deck, 6 of them are placed as prizes, and of the whole deck 4 of them are greedy dice. To represent the deck and the prizes I've made two lists of booleans - we don't actually care what the cards are, so I'm simply going to store yes or no to record if its a GD.

when game
.delete all of cards
.delete all of prizes
.
.repeat cardsInDeck
..add no to cards
.
.repeat greedy
..delete item 1 of cards
..add yes to cards

So here we go setting up a game. We clear out the cards, and the prizes, and then add 60 regular cards to the list. Then we replace 4 of those with greedy dice. Now we're ready to play!

The game starts when we deal our 6 prizes:


.
.repeat cardsInPrizes
..set deal to pick random 1 to length of cards
..add item deal of cards to prizes
..delete item deal of cards
.

Here we pick six random cards from the deck and place them in the prizes. Finally we just need to see you many of the first 5 prizes are GD:


.
.repeat cardsInPrizes-1
..if item 1 of prizes = yes
...if pick random 1 to 2 = 1
....change found by 1
..delete item 1 of prizes


We pick up the first prize card and if its a GD we toss a coin. If its heads then we've found (and successfully used) a Greedy Dice card. If its tails then we actually loose out in the game, as normally we'd get a useful card as a prize - GD is useless except to win a second prize. We keep track of the number of times we benefit.



make games number 1000000

when start
.set found to 0
.repeat games
..broadcast game and wait
.say join  "found "  join [found]  join " in "  join [games ] " games"
.say [found/games]



Now all we need to do is play a million games! A fraction of a second later, we discover we got an extra prize 167360 times in 1 million games. Thats 16.7% or about once every 6 games.
Of course I'm not the first person to figure this out:  Here some one comes up with the number: 15.83% That's a little but lower than our result, but you read closely you'll see that he's calculated the probability that you'll get one or more useful GD in any game, whereas we've counted the number of times GD's help - sometime more than one per game.

To make the two calculations match, we need to change our scoring:

.
.repeat cardsInPrizes-1
..if item 1 of prizes = yes
...if pick random 1 to 2 = 1
....change found by 1
....stop script
..delete item 1 of prizes

Now when we get a good GD card we call it a win for that match, and stop searching. Doing that we get an exact match up.

So not looking good, and about 1 game in 6 to see any benefit. However if you're new to TCG you might want to try the half deck variant - 30 cards and 3 prizes makes the games a little quicker, and its much easier to build a deck from the the cards you happen to have, rather than having to buy extras to make up a sensible 60. If we have 4 GD from 30 we're more likely to pick them for each prize slot (at the cost of taking up a greater proportion of deck space), which should help... except now we only draw 2 useful prize cards instead of 5, bringing the gain down to a useless 13%.

Either way you can probably do something more interesting with those 4 card slots than GD. Maybe in some future expansion they'll add a trainer card which lets you do something more useful with the GD card, but for now its just a dead card!

60 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Pokemon is one of the modern-day characters that many kids have come to love. Pokemons are character monsters that kids can use as a pet. But they are not real pets, of course. pokemon x rom

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Amazed by the narration and the choice of words.
    pokemon go account

    ReplyDelete
  5. Pokemon was initially created as a media franchise, not really a video game series. But since Nintendo is Nintendo pokeball crystal

    ReplyDelete
  6. Pickachu, Bulbasaur, Charmander, and Squirtle are the most popular Pokemon characters used in the game.Jackson

    ReplyDelete
  7. Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.
    downloadpopcorntimeapk.com

    ReplyDelete
  8. I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks http://www.gainfreestuff.com/free-pokemon-cards/

    ReplyDelete
  9. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!
    drastic ds emulator games

    ReplyDelete
  10. You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. Pokeball Toy

    ReplyDelete
  11. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Pokemon Masters hack

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! d6 dice

    ReplyDelete
  14. there is a need for firming lotion so that we can always maintain the health of our skin * LIFECELL REVIEWS

    ReplyDelete
  15. Apart from online dice games, offline games are blowing off.. checkout (Best Dice Games of 2020)

    ReplyDelete
  16. I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. metal dice

    ReplyDelete
  17. 'Liber Abaci' was written in 1202. His standards are applied today in numerous online mind games, just as by administrators in financial exchanges and cash markets. Subway surfer hack

    ReplyDelete
  18. Liber Abaci' was written in 1202. His standards are applied today in numerous online mind games, just as by administrators in financial exchanges and cash markets.
    why not find out more

    ReplyDelete
  19. The Twitter application page will open. This is good if you’ve got a few thousand followers, but as you get more and more the usefulness of this tool is downgraded. visit the site

    ReplyDelete
  20. Just wish to say your article is as astonishing. The clarity in your post is just great and i can assume you are an expert on this subject. Fine with your permission let me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please keep up the rewarding work. visit here

    ReplyDelete
  21. Please continue this great work and I look forward to more of your awesome blog posts. instagram likes buy uk

    ReplyDelete
  22. In the wake of seeing a great demo, it looks like they are not a long way from their objective. anime merchandise

    ReplyDelete
  23. Anyway they were additionally utilized in highlights, for example, 'Mary Poppins', where the human entertainers were imparting a world to energized animals that connected with one another.manga nelo

    ReplyDelete
  24. Free shipping in the USA, Worldwide Shipping Available. 561-877-DICE metal dice

    ReplyDelete
  25. Free shipping in the USA, Worldwide Shipping Available. Menu Norse Foundry dice rolling tray

    ReplyDelete
  26. I can set up my new idea from this post. It gives in depth information. Thanks for this valuable information for all,.. Dice Casket

    ReplyDelete
  27. Offering Royalty Free Music for Twitch, Youtube, Facebook Gaming and more. A wide variety of music from Lo-Fi, EDM, Tabletop Gaming Music and so much more! royalty free music

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. I would recommend my profile is important to me, I invite you to discuss this topic... free pokemon go accounts

    ReplyDelete
  30. In this case you will begin it is important, it again produces a web site a strong significant internet site: https://oomnex.com/product/oomnex-cuppieos

    ReplyDelete
  31. Sentence Acknowledges for penmanship such a worthy column, I stumbled beside your blog besides predict a handful advise. I want your tone of manuscript...

    ReplyDelete
  32. On this page you can read my interests, write something special. London

    ReplyDelete
  33. For many people this is important, so check out my profile: High

    ReplyDelete
  34. You may likewise need to look at specialized data too. On occasion, you may get this data from the worker depiction.Minecraft Servers

    ReplyDelete
  35. Great post, you have pointed out some excellent points, I as well believe this is a very superb website. slope

    ReplyDelete
  36. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. APLIKASI DADU ONLINE TERPERCAYA

    ReplyDelete
  37. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. 먹튀

    ReplyDelete
  38. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! 먹튀

    ReplyDelete
  39. I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work. Pokemon Unite Build

    ReplyDelete
  40. I found your this post while searching for information about blog-related research ... It's a good post .. keep posting and updating information. rumormillnews

    ReplyDelete
  41. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! Pokemon accessoires

    ReplyDelete
  42. Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content. Your views are much like my own concerning this subject. unblocked 76

    ReplyDelete
  43. I can give you the address Here you will learn how to do it correctly. Read and write something good. 먹튀검증

    ReplyDelete
  44. Heya i am with regard to the very first time right here. We found this particular panel as well as We อ่านการ์ตูน think it is really helpful & this assisted me personally away much. I really hope to provide some thing back again as well as aid other people as if you aided me personally.

    ReplyDelete
  45. 3d nachtlicht I would like to say that this blog really convinced me to do it! Thanks, very good post.

    ReplyDelete
  46. Hello, there's no doubt that we spotted you actually seen this blog thus i actually arrived at 途eturn a favor・I'm attempting to obtain things enhance this web site! manga

    ReplyDelete
  47. Gives you the best website address I know there alone you'll find how easy it is. run 3 unblocked online

    ReplyDelete
  48. Such blogs are very useful to us. What we learned here is that we need us badly in life. First of all, I would like to thank you for such sharing. html5

    ReplyDelete
  49. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. ufabet เว็บตรง

    ReplyDelete
  50. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. unique domain

    ReplyDelete
  51. Ireland, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Norway, Poland, Romania, Slovakia, Slovenia, Sweden, and Switzerland. Who can say for sure? in view of the huge measure of players locally, I don't figure Philippines will be overlooked just as other Asian nations who has huge number of players anticipating this game. minecraft servers

    ReplyDelete
  52. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. 토토사이트검증

    ReplyDelete
  53. I think this good information can only be found here. I will always visit this blog. Thank you for the good comments. 메이저토토

    ReplyDelete
  54. Therefore scripts accessible on the internet that allow people to create a manga video site with a ton of content inside of a week.  4anime

    ReplyDelete
  55. pokemon kuscheltier pikachu I would like to say that this blog really convinced me to do it! Thanks, very good post.

    ReplyDelete
  56. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. Dice Vault

    ReplyDelete
  57.  In addition, i know that you need to learn how to draw Manga and you are aware that it isn't a hassle-free task. Let's say I mentioned an easy method to attract your favorite manga character just in steps? Or, imagine I told you that you just is able to draw your personal character created on your own imagination? 4anime

    ReplyDelete
  58. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. pokemon tiere

    ReplyDelete
  59. Hey, what a brilliant post I have come across and believed me I have been searching out for this similar kind of post for the past week and hardly came across this. Thank you very much and will look for more postings from you.
    CBD Balm Boxes
    Custom CBD Capsule Boxes
    Custom Popcorn Boxes
    custom lip balm packaging boxes
    Custom Vape Packaging Boxes
    Custom Mini Burger boxes
    printed eye shadow Boxes
    Custom Candle Packaging Boxes
    Custom printed soap boxes
    cardboard cones wholesale

    ReplyDelete
  60. A hematologist is a doctor who specializes in the diagnosis and treatment of blood disorders. Hematologists are experts in the production, function, and disorders of blood cells. They use their knowledge to treat conditions such as anemia, bleeding disorders, and blood cancers. medscape.com
    medifind.com
    beqbe.com
    blogspot.com

    ReplyDelete