aboutsummaryrefslogtreecommitdiff
path: root/projects/10/ExpressionLessSquare/Square.jack
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
committerYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
commitd3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 (patch)
treed58df9ec2480e2a9ec6240f9c797f83d1a0b1056 /projects/10/ExpressionLessSquare/Square.jack
parent3571f998b28fbc8d9250ba04c983935f10a16c15 (diff)
rearranged the dir for github
- removed tools and pdfs - rearranged the projects dirs - added md files - other minor changes
Diffstat (limited to 'projects/10/ExpressionLessSquare/Square.jack')
-rw-r--r--projects/10/ExpressionLessSquare/Square.jack99
1 files changed, 0 insertions, 99 deletions
diff --git a/projects/10/ExpressionLessSquare/Square.jack b/projects/10/ExpressionLessSquare/Square.jack
deleted file mode 100644
index 33a54ad..0000000
--- a/projects/10/ExpressionLessSquare/Square.jack
+++ /dev/null
@@ -1,99 +0,0 @@
-// This file is part of www.nand2tetris.org
-// and the book "The Elements of Computing Systems"
-// by Nisan and Schocken, MIT Press.
-/// File name: projects/10/ExpressionLessSquare/Square.jack
-
-/** Expressionless version of projects/10/Square/Square.jack. */
-
-class Square {
-
- field int x, y;
- field int size;
-
- constructor Square new(int Ax, int Ay, int Asize) {
- let x = Ax;
- let y = Ay;
- let size = Asize;
- do draw();
- return x;
- }
-
- method void dispose() {
- do Memory.deAlloc(this);
- return;
- }
-
- method void draw() {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- return;
- }
-
- method void erase() {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- return;
- }
-
- method void incSize() {
- if (x) {
- do erase();
- let size = size;
- do draw();
- }
- return;
- }
-
- method void decSize() {
- if (size) {
- do erase();
- let size = size;
- do draw();
- }
- return;
- }
-
- method void moveUp() {
- if (y) {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- let y = y;
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- }
- return;
- }
-
- method void moveDown() {
- if (y) {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- let y = y;
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- }
- return;
- }
-
- method void moveLeft() {
- if (x) {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- let x = x;
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- }
- return;
- }
-
- method void moveRight() {
- if (x) {
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- let x = x;
- do Screen.setColor(x);
- do Screen.drawRectangle(x, y, x, y);
- }
- return;
- }
-}