Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CS 1334 Programming Assignment Assignment #8 Your eighth programming assignment consists of two JS programs. It should compile correctly and produce the specified output. Give meaningful name to the...

1 answer below »
CS 1334 Programming Assignment






Assignment #8

Your eighth programming assignment consists of two JS programs. It should compile co
ectly
and produce the specified output. Give meaningful name to the program and submit the link to
eLearning.

Please note that the program should comply with the commenting and formatting rules we
discussed in class.
Pseudocode High level explanation of steps
at the top of program/each function
10%
Source Code Overall design of the program 40%
Source Code Formatting and coding style 20%
Execution Test cases 30%
Program # XXXXXXXXXXpoints
 Use transformation functions to create a neighborhood.
 Be as creative as possible. Try to include playing area, some mom and pop stores,
a
eque area, some sitting area.
 One sample is attached here. It doesn’t have to be an exact replica of this.



Total Points (200 pts)
Program #2 Houses and School 100 points
We have worked on a few fancy drawings using translate(), rotate() and scale(). Use those
examples as reference and write the code to replicate the user's drawing in top-left 100x100 area
like the following: Stretch it horizontally 3 times in the right 300x100 area, stretch it 3 times
vertically in the bottom 100x300 area & draw the image in 3x size in bottom-right 300x300 area.
Save your project & copy the web-link here and complete this assignment. Hints: You can use
mouseDragged event to keep drawing. You can use line(pmouseX, pmouseY, mouseX,
mouseY); keep the points connected. You can use scale(3, 1) to stretch along x axis ONLY and
scale(1, 3) to stretch along y axis ONLY. Please look at the video for more clarity
    CS 1334 Programming Assignment
    Assignment #8
    Program # XXXXXXXXXXpoints
    Program #2 Houses and School 100 points
Answered 5 days After Apr 06, 2021

Solution

Sandeep Kumar answered on Apr 07 2021
128 Votes
let button;
let curTurn;
let curStroke;
let aiTurn;
let txtDiv;
let corner;
function setup() {
    let myCanvas = createCanvas(600, 600);
    myCanvas.parent("canvas");
    corner=myCanvas.position();
    console.log(corner);
    console.log(corner.x, corner.y);
    button = createButton('CLEAR');
    button.center();
    button.style('margin-top', '45vh');
    button.mousePressed(() => {
        background(255);
    });
    background(255);
    cu
entSetting = {
        size: 5,
        col: color(0, 0, 0, 150)
    }
    agentSetting = {
        size: 5,
        col: color(150, 0, 0, 150)
    }
    curTurn = [];
    curStroke = [];
    aiTurn = [];
}
function draw() {
    if (aiTurn.length == 0) {
        if (mouseIsPressed && isInsideCanvas(mouseX, mouseY)) {
            stroke(cu
entSetting.col);
            noFill();
            strokeWeight(cu
entSetting.size);
            line(pmouseX, pmouseY, mouseX, mouseY);
            curStroke.push([mouseX, mouseY]);
        }
    } else {
        noFill();
        strokeWeight(cu
entSetting.size);
        if...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here