首页 » Nodejs代写 » Nodejs代写 | COM S/SE 319 : Construction of User Interfaces Fall 2020 Homework 3

Nodejs代写 | COM S/SE 319 : Construction of User Interfaces Fall 2020 Homework 3

这个作业是用nodejs+html完成一个贪吃蛇游戏
COM S/SE 319 : Construction of User Interfaces
Fall 2020
Homework 3

Task 1: Event Handling (20 points)
Write Javascript and HTML code (named snake.html and snake.js) to implement the functionality shown
in ‘Task1Output.mp4’ included in the zip file. Some example code is given in
task1/ExampleCodesGeneral as well.
Note:
1. The line you create can go over any upcoming paths. [4 points]
2. The line will bend left when the left button is clicked. [4 points]
3. The line will bend right when the right button is clicked. [4 points]
4. The line should stop in following conditions: [8 points]
a. The snake touches the edges of the rectangle [2 points].
b. The snake’s head touches its body [2 points].
c. User clicks on the “stop” button [4 points].
● When the user clicks on the “stop” button, the button text should change to “start”, which
allows the snake to continue move if there are no boundaries as those given in 4a and 4b.
Hints:
a. The setInterval(function, delay) schedules the “code” after every “delay”
microseconds.
b. The clearInterval removes the timer
Here is an example of timer code. This will countdown from 100 until you press stop!
Task 2: (25 points)
Objective
Learn to use node.js programming.
NOTE 1: Play with the given “example.js” in task2 sub-folder. Open using a text editor of your choice
and modify to learn how the different instructions work.
Task
Note: It will be a console based application.
Your assignment is to create a program in node.js named “hw3.js” that can do the following
operations. You can start with the given warm-up example “example.js” and follow lab activity 3. You
need to install ‘readline-sync’ like here.
1. Take four integer numbers as input from the console using ‘readline-sync’ like given example
code. So, the user should be given a prompt for entering all 4 numbers one by one then need to
press enter for getting the output. (5 points)
2. Calculate the factorial of the first number. In the console, the factorial of that first given
number should be shown as an output. (5 points)
3. Calculate the sum of all the digits of the second number. For example, if we have the number
1234, the program will calculate 1+2+3+4 which is equal to 10. (5 points)
4. For the third number given as an input, show the reversed number as an output. For
instance, if we give 12345 as input, it will show 54321 as output (5 points)
5. For the fourth number given as an input, check whether that number is a Palindrome or
not and show the output as True in case it is a palindrome and False if it is not a palindrome. For
example, if we give “12345” as an input it will return false but if we give 12321 as input, it will
return true. (5 points)


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank