Giter Club home page Giter Club logo

microsoft / car-trumps Goto Github PK

View Code? Open in Web Editor NEW
14.0 58.0 19.0 3.51 MB

Car Trumps is a well-known children's card game for Windows Phone 8. In it you are dealt a car card in random, and you must choose what you think is the car’s best category. The selected category is compared to your friend’s car, and the winner gets both cards. This application demonstrates the use of NFC for communication between Windows Phone 8 devices.

License: Other

C# 100.00%

car-trumps's Introduction

Car Trumps

Car Trumps is a Windows Phone 8 example game, based on a well-known children's card game. Basically the aim of the game is to select one property from a card in your hand (e.g., the car's top speed) which you think can beat the opponent's selection. This is a two player game, and requires two phones with NFC support.

The game starts when the players touch the phones together. A random hand is given to both players from the deck. Both players select a card from their decks. Then the other one of the players has to choose a property to compare. The comparison is executed by touching the devices together. The winner gets the opponent's losing card. The game ends when either player runs out of cards.

This example application is hosted in GitHub: https://github.com/Microsoft/car-trumps

For more information on implementation and porting, visit Lumia Developer's Library: http://developer.nokia.com/Resources/Library/Lumia/#!code-examples/car-trumps.html

This project is compatible with Windows Phone 8 and has been developed with Microsoft Visual Studio Express 2012 for Windows Phone.

  1. Instructions

To build the application you need to have Windows 8 and Windows Phone SDK 8.0 or later installed.

Using the Windows Phone 8 SDK:

  1. Open the SLN file: File > Open Project, select the file CarTrumps.sln
  2. Select the target 'Device'.
  3. Press F5 to build the project and run it on the device.

Please see the official documentation for deploying and testing applications on Windows Phone devices: http://msdn.microsoft.com/en-us/library/gg588378%28v=vs.92%29.aspx

  1. Implementation

Important files and classes:

  • Nfc/NfcManager.cs: Wrapper for the ProximityDevice. Handles submission and subscription of NFC messages. The class contains two methods used by MainPage and GamePage;
    • DealCards(): Sends a DealCards message, which starts a new game. The message contains ids of opponent's cards, and a random id, which is used to decide which player's randomised cards are used.
    • ShowCard(): Sends a ShowCard message. The message contains selected card id and property.
  • Nfc/NfcInitiationMessage.cs: This message type is used in the custom initiation protocol to decide the master/slave relationship between the two devices before the game is started.
  • Nfc/NfcMessage.cs: Container for a NFC message, handles (de)serialization. In practice the binary message sent via NFC is a XML document.
  • Model/CardModel.cs: Model for the pages. Contains also simple game logic; shuffling of the cards, winner decision, etc.
  • MainPage.xaml.cs: The game starts from and ends at the main page. Mainpage handles the DealCards message, which starts a new game.
  • GamePage.xaml.cs: The in-game page. Handles the ShowCard message. The lower part of the page consists of a Panorama holding the card properties. The top part is reserved for the car's image.

Required capabilities:

  • ID_CAP_NETWORKING
  • ID_CAP_PROXIMITY
  1. Known issues

  • Wrong card may be selected, if the touch between the phones is too weak.
  1. License

See the license text file delivered with this project. The license file is also available online at https://github.com/Microsoft/car-trumps/blob/master/Licence.txt

All the car images were taken from Wikipedia. Here is a complete list of the used images (public domain):

GNU Free Documentation License: http://en.wikipedia.org/wiki/en:GNU_Free_Documentation_License

  1. Version history

  • Version 1.0: The initial release.

car-trumps's People

Contributors

mortonfox avatar tompaana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.