<commit_before>import 'dart:html';
import 'dart:async';
import 'dart:math';

// XXX This should be a class
//     it should also be on github.
//     Todo:  - Arrays with collision detection [check]
//            - Get the background color of the canvas to facilitate proper overwriting?
//                -- Naah, just figure out the coords of the backtround and paint it in the
//                   appropriate color.[Check]
//            - Detecting collisions on the walls.
//                o Determining what the coords of the walls are as a function of
//                  canvas size.[Check]
//            - Adding movement to the tail[Check]
//            - Add gold that can be converted into points.
//            - Showing the score.
//            - Crazy music.
//            - Psychedelic colors to keep the mind off balance.
//            - Doing it all in 3D (starting off in the plane, then
//               tilting the view into the plane, and rotating the plane
//               while the game is going on.

num x = 10;
num y = 10;
num width = 10;
num height = 10;
num initialPauseInMillis = 400;
num pauseInMillis = initialPauseInMillis;
num tailIncreaseInterval = 5000;


class Coord {
  String name;
  int x;
  int y;

  Coord(int x, int y) {
    this.x = x;
    this.y = y;
    name = "";
  }

  void add(Coord c) {
    x += c.x;
    y += c.y;
  }

  Coord copy() {
    return new Coord(x, y);
  }

  void paint(color) {
    print("Paointing $color");
    CanvasElement canvas = querySelector("#myCanvas");
    var gc = canvas.getContext('2d');
    gc.fillStyle = color;
    gc.fillRect(width * x, height * y, width, height);
  }


  void paintBlack() {
    paint("#000000");
  }


  void paintWhite() {
    paint("#FFFFFF");
  }

  bool equals(Coord other) {
    return ((other.x == x) && (other.y == y));
  }
}

class Snake {
  int maxSize = 3;
  List<Coord> coords = new List();

  int cwidth;
  int cheight;

  int cowidth;
  int coheight;

  int points = 5;

  Snake() {
    // XXX Layering violation
    CanvasElement canvas = querySelector("#myCanvas");
    coords.add(new Coord(10, 10));
    cwidth = canvas.width;
    cheight = canvas.height;

    // XXX Math.round dosn't exist but you get my drift.

    cowidth = (cwidth / width).round();
    coheight = (cheight / width).round();
    clearCanvas();
    assert(coords.length == 1);
  }

  void addPoints(num delta) {
    points += delta;
  }

  void showData() {
    showPoints();
    showDirection();
  }

  void showPoints() {
    var pts = querySelector("#points");
    pts.text = "Points: ${points}";
  }

  void showDirection() {
    var pts = querySelector("#direction");
    pts.text = "Direction: ${direction.name}";<commit_msg>Remove useless comment<commit_after>import 'dart:html';
import 'dart:async';
import 'dart:math';

// XXX This should be a class
//     it should also be on github.
//     Todo:  - Arrays with collision detection [check]
//            - Get the background color of the canvas to facilitate proper overwriting?
//                -- Naah, just figure out the coords of the backtround and paint it in the
//                   appropriate color.[Check]
//            - Detecting collisions on the walls.
//                o Determining what the coords of the walls are as a function of
//                  canvas size.[Check]
//            - Adding movement to the tail[Check]
//            - Add gold that can be converted into points [check].
//            - Showing the score.
//            - Crazy music.
//            - Psychedelic colors to keep the mind off balance.
//            - Doing it all in 3D (starting off in the plane, then
//               tilting the view into the plane, and rotating the plane
//               while the game is going on.

num x = 10;
num y = 10;
num width = 10;
num height = 10;
num initialPauseInMillis = 400;
num pauseInMillis = initialPauseInMillis;
num tailIncreaseInterval = 5000;


class Coord {
  String name;
  int x;
  int y;

  Coord(int x, int y) {
    this.x = x;
    this.y = y;
    name = "";
  }

  void add(Coord c) {
    x += c.x;
    y += c.y;
  }

  Coord copy() {
    return new Coord(x, y);
  }

  void paint(color) {
    print("Paointing $color");
    CanvasElement canvas = querySelector("#myCanvas");
    var gc = canvas.getContext('2d');
    gc.fillStyle = color;
    gc.fillRect(width * x, height * y, width, height);
  }


  void paintBlack() {
    paint("#000000");
  }


  void paintWhite() {
    paint("#FFFFFF");
  }

  bool equals(Coord other) {
    return ((other.x == x) && (other.y == y));
  }
}

class Snake {
  int maxSize = 3;
  List<Coord> coords = new List();

  int cwidth;
  int cheight;

  int cowidth;
  int coheight;

  int points = 5;

  Snake() {
    // XXX Layering violation
    CanvasElement canvas = querySelector("#myCanvas");
    coords.add(new Coord(10, 10));
    cwidth = canvas.width;
    cheight = canvas.height;

    cowidth = (cwidth / width).round();
    coheight = (cheight / width).round();
    clearCanvas();
    assert(coords.length == 1);
  }

  void addPoints(num delta) {
    points += delta;
  }

  void showData() {
    showPoints();
    showDirection();
  }

  void showPoints() {
    var pts = querySelector("#points");
    pts.text = "Points: ${points}";
  }

  void showDirection() {
    var pts = querySelector("#direction");
    pts.text = "Direction: ${direction.name}";
{'fraction_non_alphanumeric': 0.12534715793371598, 'fraction_numerical': 0.011109053878911312, 'mean_word_length': 2.1720493247210806, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4792979', 'n_tokens_mistral': 1782, 'n_tokens_neox': 1663, 'n_words': 561}