How many people are playing 2048? Now it's 4096.

Source: Internet
Author: User

2048 is a popular digital game. The original version 2048 was first released on GitHub, and the original author was Gabriel cirulli. It is a new type of digital game [1] developed based on "1024" and "Little 3 Legend".
Later, various versions were available in 2048, using various platforms. The versions transplanted from ketchapp to IOS are the most popular, with about 10 million downloads. Their names are exactly the same as those of the original version. The most famous derivative version is the 2048 hexagonal version,

Board games ranked the top 200 in 81 countries around the world.

The Android version is very popular with challenge 2048, and its version 2.0.0 has also joined the dual-player competition.

The second most special version is the 2048 Chinese dynasty version. The 2048 custom version allows you to customize text and images. 2048 is a popular version in IOS.

Hello everyone, start

Address: http://10086bank.com/2048/index.html

First:

My ideas:

Obtain the IP address of the client -- locate the IP address location -- Obtain the lower-level district and county of the IP address and display it on the page.

 

Code:

JS:

If (province = "Beijing") {return ["Dongcheng", "Xicheng", "Chaoyang", "Fengtai", "Huairou", "Haidian", "Miyun ", "Fangshan", "Tongzhou", "Changping", "Beijing"];}



Function.prototype.bind = Function.prototype.bind || function (target) {    var self = this;    return function (args) {        if (!(args instanceof Array)) {            args = [args];        }        self.apply(target, args);    };};(function () {    if (typeof window.Element === "undefined" ||      "classList" in document.documentElement) {        return;    }    var prototype = Array.prototype,      push = prototype.push,      splice = prototype.splice,      join = prototype.join;    function DOMTokenList(el) {        this.el = el;        // The className needs to be trimmed and split on whitespace        // to retrieve a list of classes.        var classes = el.className.replace(/^\s+|\s+$/g, ‘‘).split(/\s+/);        for (var i = 0; i < classes.length; i++) {            push.call(this, classes[i]);        }    }    DOMTokenList.prototype = {        add: function (token) {            if (this.contains(token)) return;            push.call(this, token);            this.el.className = this.toString();        },        contains: function (token) {            return this.el.className.indexOf(token) != -1;        },        item: function (index) {            return this[index] || null;        },        remove: function (token) {            if (!this.contains(token)) return;            for (var i = 0; i < this.length; i++) {                if (this[i] == token) break;            }            splice.call(this, i, 1);            this.el.className = this.toString();        },        toString: function () {            return join.call(this, ‘ ‘);        },        toggle: function (token) {            if (!this.contains(token)) {                this.add(token);            } else {                this.remove(token);            }            return this.contains(token);        }    };    window.DOMTokenList = DOMTokenList;    function defineElementGetter(obj, prop, getter) {        if (Object.defineProperty) {            Object.defineProperty(obj, prop, {                get: getter            });        } else {            obj.__defineGetter__(prop, getter);        }    }    defineElementGetter(HTMLElement.prototype, ‘classList‘, function () {        return new DOMTokenList(this);    });})();





 

 



function KeyboardInputManager() {    this.events = {};    if (window.navigator.msPointerEnabled) {        //Internet Explorer 10 style        this.eventTouchstart = "MSPointerDown";        this.eventTouchmove = "MSPointerMove";        this.eventTouchend = "MSPointerUp";    } else {        this.eventTouchstart = "touchstart";        this.eventTouchmove = "touchmove";        this.eventTouchend = "touchend";    }    this.listen();}KeyboardInputManager.prototype.on = function (event, callback) {    if (!this.events[event]) {        this.events[event] = [];    }    this.events[event].push(callback);};KeyboardInputManager.prototype.emit = function (event, data) {    var callbacks = this.events[event];    if (callbacks) {        callbacks.forEach(function (callback) {            callback(data);        });    }};KeyboardInputManager.prototype.listen = function () {    var self = this;    var map = {        38: 0, // Up        39: 1, // Right        40: 2, // Down        37: 3, // Left        75: 0, // Vim up        76: 1, // Vim right        74: 2, // Vim down        72: 3, // Vim left        87: 0, // W        68: 1, // D        83: 2, // S        65: 3  // A    };    // Respond to direction keys    document.addEventListener("keydown", function (event) {        var modifiers = event.altKey || event.ctrlKey || event.metaKey ||                    event.shiftKey;        var mapped = map[event.which];        // Ignore the event if it‘s happening in a text field        if (self.targetIsInput(event)) return;        if (!modifiers) {            if (mapped !== undefined) {                event.preventDefault();                self.emit("move", mapped);            }        }        // R key restarts the game        if (!modifiers && event.which === 82) {            self.restart.call(self, event);        }    });    // Respond to button presses    this.bindButtonPress(".retry-button", this.restart);    this.bindButtonPress(".restart-button", this.restart);    this.bindButtonPress(".keep-playing-button", this.keepPlaying);    // Respond to swipe events    var touchStartClientX, touchStartClientY;    var gameContainer = document.getElementsByClassName("game-container")[0];    gameContainer.addEventListener(this.eventTouchstart, function (event) {        if ((!window.navigator.msPointerEnabled && event.touches.length > 1) ||        event.targetTouches > 1 ||        self.targetIsInput(event)) {            return; // Ignore if touching with more than 1 finger or touching input        }        if (window.navigator.msPointerEnabled) {            touchStartClientX = event.pageX;            touchStartClientY = event.pageY;        } else {            touchStartClientX = event.touches[0].clientX;            touchStartClientY = event.touches[0].clientY;        }        event.preventDefault();    });    gameContainer.addEventListener(this.eventTouchmove, function (event) {        event.preventDefault();    });
 

 




 

Add me to the Code: 502048227 cute/rose

 

 

No time to write, want to play can look at: http://10086bank.com/2048/index.html do not play also welcome! [Keyboard upper and lower left Keys] the mobile phone slides up, down, left, and right !!!!!!!!!!!!!!!!

 

Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.