Giter VIP home page Giter VIP logo

2048-tutorial's People

Contributors

curiousleo avatar dbuenzli avatar kayceesrk avatar lpw25 avatar samoht avatar yallop avatar yomimono avatar

Stargazers

 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

Watchers

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

2048-tutorial's Issues

Fit board to mobile browser window and accept swipe input

After visiting the link in #16 from my iOS device, I thought it would be cool to add support for swipe input and also fit the board to the browser window.

This obviously won't be ready for the actual tutorial but perhaps can be considered later — or maybe some hints provided for those keen enough to try and implement it.

Cubieboards / VMs

We discussed setting up Cubieboards and VMs as a contingency plan in case people turn up with Windows computers.

Plan:

  • @yallop to write a script that installs the relevant bits and pieces (OPAM packages, a copy of the project repository, etc.) for a fresh user account.
  • @avsm to set up VMs (and Cubieboards?)

OPAM-on-a-stick

Prepare an offline OPAM repository (and perhaps a copy of RWO) for distribution on USB sticks (mostly in case the network goes down).

What packages do we need?

Improve instructions, perhaps with diagrams

@kayceesrk noticed that the instructions are difficult to follow in places, and could be improved with examples or diagrams. For example, the instructions for shift_left_helper currently list various cases like this:

The first two squares are occupied by equal tiles. Merge them together, add an entry to the empties list, and process the rest of the row.

which sounds rather like medieval mathematics and could be made clearer with diagrams, perhaps like this:

shift_left_helper   ..    ..    shift_left_helper  ..   ..

Reusing project as teaching material

Hi,
I'm interested in using and possibly adapting this tutorial for use in a workshop I'd like to teach.
Are there any extra restrictions on re-using this repo outside of the BSD2 license placed on the code in the 2048 directory?
The workshop would not be for profit, just fun.

Thanks

The tests for is_complete_row are insufficient.

A participant at the CUFP 2014 tutorial wrote an implementation of is_complete_row that passed the tests but misbehaved when run as part of the game. It seems that the tests didn't catch the interchanging of the Some and None cases.

Notebook: datatypes

  • Defining datatypes
    • Very simple records and variants.
    • We won't need to define parameterised or recursive types (but those concepts will be needed to understand list)
  • Lists
  • Options
    • we should say that option isn't special (i.e. it's not OCaml's equivalent of null, which is sui generis)
  • Constructing values
  • Pattern matching
    • Using match should be sufficient: no need for destructuring let or for function
    • match for records, variants, options and lists
    • some deep pattern matching
    • when guards
    • nested match: need to parenthesize the inner match

Animation performance in FF and Safari

So I investigated a bit. And it seems that the problem is in the canvas rendering performance (i.e. the call to Vgr.render). The numbers are rather astonishing. One thing I don't get is why Safari doesn't call us more often for animating as we are still below the 16ms limit for getting a 60Hz animation.

Here's an example of the render frame timings for a transition in the three browsers:

Chrome

START:
4.244ms; 4.255ms; 2.87ms; 4.163ms; 1.889ms; 2.36ms; 3.311ms; 3.692ms; 1.605ms; 2.658ms; 2.784ms; 2.162ms; 2.258ms; 1.688ms; 1.554ms; 1.951ms; 1.641ms; 1.564ms; 1.242ms;
END : 19 frames @ 63.3333hz 

Firefox

START: 
21.9351ms; 21.316ms; 19.3239ms; 19.8034ms; 23.8123ms; 20.0289ms; 22.8311ms; 21.8929ms; 22.9779ms; 24.0915ms; 21.9377ms; 21.2064ms;
"END : 12 frames @ 40hz

Safari

START:
7.00021ms; 9.00006ms; 16ms; 11.0002ms; 6.99997ms; 7.00021ms; 8.99982ms; 9.99999ms; 11.0002ms; 16ms; 15.0001ms; 9.99999ms; 9.00006ms; 8.00014ms;
END : 14 frames @ 46.6667hz

Notebook: basics

  • let (rec) for defining functions and values
  • if/then/else
  • function calls (including partial application)
  • labelled arguments (if we're going to use Core)

2048: extensions

  • improving representations/types for efficiency
  • improving representations/types for correctness
  • gameplay enhancements
  • ui enhancements

Be more precise with provenance.

I also think that we could could be less loose with the possible cases in provenance by using a variant (see actual comment above the datatype). This could make this pattern match more obvious. It may however complexify the provenance computation code, so this may turn out to be a bad idea.

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.