Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

September, 2010

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Would you play this game?


    I love puzzles and small little programming projects. When you can combine those two at get a project that you can use for a good learning/teaching experience it is just a bit of gold. When the concepts you can get into the project go beyond programming so much the better. And I think I have found one of these nuggets. About a week ago someone sent the following puzzle to a mailing list I am on.

    You walk into a casino and discover that they are offering an exciting new game called 52-Card Match, which is played with two ordinary 52-card decks of playing cards.

    The player is handed one deck, and the dealer takes the other. The dealer thoroughly shuffles his deck and sets it face down in front of you. You can shuffle your deck as thoroughly as you please and then also set it face down in front of you.

    The cards are then turned over one at a time from each deck, i.e. one from each deck is turned over simultaneously each time. If any pair matches exactly (rank and suit), the game is over and the casino wins. If you make it through the whole deck without a match then the player wins, and is paid out at 2:1 odds.

    Should you play this game? What would fair odds be?

    Now there is surely a good mathematical way to figure this out. No doubt it would make a great project for a class in statistics. But I’m a programming guy. I did take statistics in college – two or three courses of it – but it’s been 35 years and I haven’t kept up with it. What  I do know how to do is simulate the game. So that is what I did. Basically what I did (rough outline) was this:

    1. Create two 52 element integer arrays and fill them with the integer values 1 through 52.
    2. “Shuffle” the arrays. I used random numbers to pick two elements to swap and did that n times. I tried a couple of values for n.
    3. Create a loop to check each element of the arrays to see if the values in element x in both arrays was the same and report that if it happened.
    4. Then I put all of that in a loop so I could run the simulation multiple times. I wound up running it a couple of million times.

    The results surprised me. Surprised me a lot. In fact this morning I had to take out two decks of real cards and try it in real life. Simulation and real life had the same sort of results. Makes one feel good when that happens.

    I think this might be fun for students as well. And of course you have arrays (parallel arrays probably but maybe a two dimensional array if you want), loops, and the ever popular random numbers. The math/statistics involved are potentially interesting as well because you can compare the expected results with what you see in the simulations.

    For added fun (and complexity) you could keep track of how many times there was a match in each run of the deck comparisons. Perhaps there is a variation (you have to match three or more times  to lose for example) you could find that actually makes more sense to play? Get the kids in AP Statistics to do the math for you and compare their results with the simulation.

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Interesting Links 27 September 2010


    Last week I wrote a post about the Imagine Cup. (Imagine Cup–Solving the Worlds Problems Through Software) A couple of things I should have mentioned about it though. One is there is a chance for students who enter to win an Xbox 360 console with the new Kinect each week to one random Imagine Cup registrant .Read the full rules at Imagine Cup Rules. The other thing I should have emphasized is that the Round 1 quizzes for the Information Technology (IT) Challenge have started. You can get the full schedule at IT Challenge web site. It’s not to early to work at qualifying for Round 2.

    In other links, Ken Royal @kenroyal had an interesting article on  Top 25 Ed Tech Trends. Well worth the read.

    Brandon Watson @BrandonWatson announced that Visual Basic is now available to support Silverlight development for the  WindowsPhone7. Visual Basic Comes to Windows Phone 7 As a big VB fan boy from way back this is pretty exciting to me.

    @weemooseus Twittered a link to a post by a student who wrote up his list if the Top 5 AP Computer Science Tips. It’s an interesting list with some good suggestions.

    The World Wide Innovative Forum is coming up this week in South Africa. Leading up to it Tony Franklin has been posting some guest posts from the US teachers who are going.

    What does your school need? The team at Bing is running a contest to provide money to schools. Check the program out here. Learn more about Bing programs for educators, visit

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Imagine Cup–Solving the Worlds Problems Through Software


    There are many indications that today’s students are motivated as much, if not more, by the chance to make a difference in the world as they are to make money. By the same token it is not always obvious or clear to these students that computer science and software has huge potential to do a bit of both. But in fact computer science is making a big difference I the world and could potentially make an even larger difference. This is the logic behind the Imagine Cup, arguably the world’s premier student technology competitions, basing their theme around the UN Millennium Goals. The goal of the Imagine Cup most briefly is to:

    Imagine a world where technology helps solve the toughest problems


    So what is the competition? Actually a series of competitions and challenges that open the doors for multiple types of solutions in different areas of interest.

    The top event is the Software Design competition to create real-world software applications using Microsoft technologies. The Embedded Development event involved using a provided embedded platform and the  Windows Embedded Compact Framework to create a new and innovative solution to a real problem. The Game Design competition is about creating a game that helps teach, provide access to more people or solve other real world issues. Last year one of the top teams in the US was a high school team BTW.

    The Digital Media competition is all about “your big idea could enlighten folks around the world about major global issues.” Photos, videos, music – no matter what form of digital media you are into are you thinking about how you can use your skills to change the world?

    The IT Challenge is for students who love to play with the hardware and software mix. “The object of this challenge is to highlight the art and science of developing, deploying, and maintaining IT systems that are efficient, functional, robust, and secure.” Round 1 is a series of online quizzes. take as many or as few as you’d like and score 15 or more on one of them to move to the next round. There is even a practice round you can try today.

    Now to be honest and upfront, most of the competitors are college and university students. So it can be a daunting for a high school student to put together a team. But while winning is always a goal there are other benefits of competing. For one thing it is a chance to push yourself to the limits of what you know and move past them. Are you up to university work? Beating out a bunch of college students would show that even if you didn’t beat them all. Are you looking for something that sets you apart from other high school students looking to get into a good college? Well showing the admissions office that you have the drive, the ambition, the skills (like communication and leadership) to work with a team through a major international competition should be a good start.

    And maybe you will win. What events should you look at? Well a lot depends on your interests. If you are an IT student learning systems and network management you should really try to test yourself with the IT Challenge. Are you a digital artist than give it all you have in The Digital Media competition. Are you a programming student than the Game Design may just be your thing.

    Are you up to the top of the line Software Design competition? This one requires a real time commitment. Are you up for it? Few high school students are with all they have going on in their lives. Are you and your friends the exceptions?

    Of course if you are in college or university this is your chance to go up against the best and brightest in the world. No excuses if you want to show the world just how ready to change the world you are!


Page 1 of 6 (18 items) 12345»