sunjay / turtle

Create Animated Drawings in Rust
http://turtle.rs
Mozilla Public License 2.0
562 stars 53 forks source link

Reversi Example #39

Open sunjay opened 6 years ago

sunjay commented 6 years ago

Motivation & Vision

One thing I'd like people to see about turtle is that, in a way, it is actually just a graphics engine with a very specific (additive) rendering model. That means that you can write quite a few kinds of applications and games using turtle. With its events model, you can even write interactive applications.

Right now, you can use turtle to create any application that can be modelled so that new pieces of interface are drawn on top of previous ones. Sometimes this takes a bit of creativity, like it did in this example, but you can definitely create a lot using the simple primitives provided by this library. In the future, even that limitation will be lifted and you will be able to create even more using turtle.

The reason that this is important is because it allows turtle to be a legitimate learning tool for applications that go beyond simple toy examples. If we can accomplish this goal, we can take people writing programs that draw simple circles and teach them to write actually useful and productive applications. The smaller we make the gap between crates like turtle and creating applications with more traditional and advanced frameworks, the easier it will be for people to make that transition.

Note: the point is not for people to actually use turtle instead of an actual GUI library. The point is to close most of the gap so that switching to something beyond turtle isn't impossible. It's important to think about where people will go after learning about the library.

Reversi

This example is in progress. By the time it is finished, the game Reversi will be fully implemented. This game is perfectly suited to turtle because it doesn't require completely re-rendering the scene every frame. We can just keep adding things on top of the existing drawings.

As turtle matures and gains more features, this example can improve and gain more advanced features. For example, when undo gets added, there's a possibility of drawing indicators on the valid moves and then undoing them away when the user clicks. With text support (#22), we could render the score on the screen.

Progress So Far

The turtle responds to mouse clicks and draws new pieces on the board. No rules are enforced yet and you cannot win/lose.

peek 2017-12-08 20-16

codecov[bot] commented 3 years ago

Codecov Report

Merging #39 (544e7c9) into master (c3a79e6) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #39   +/-   ##
=======================================
  Coverage   61.32%   61.32%           
=======================================
  Files          40       40           
  Lines        2697     2697           
=======================================
  Hits         1654     1654           
  Misses       1043     1043           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c3a79e6...544e7c9. Read the comment docs.