Keybase proof
I hereby claim:
- I am ruyili on github.
- I am wecryopen (https://keybase.io/wecryopen) on keybase.
- I have a public key ASBErN8SGkckrb14D073PzIuuJUwbAoEmXSnAFQKiNEYFgo
To claim this, I am signing this object:
# Author: weCryOpen (Ruyi Li) | |
function d1p1(file) | |
open(file) do f | |
total = 0 | |
for line in eachline(f) | |
# Iterate through each line in the file | |
# Convert it to an integer, | |
n = parse(Int, line) | |
# and add it to the total. |
# Author: Ruyi Li (weCryOpen) | |
function mypi(n::Int)::Float | |
total_sum::Float = 0 | |
for i = 1:n | |
total_sum += 1 / (i * i) | |
end | |
(total_sum * 6) ^ 0.5 | |
end |
<canvas></canvas> | |
<button onclick="josephus()"> Start </button> | |
<button onclick="eliminate()"> Kill </button> | |
<script> | |
const canvas = document.querySelector('canvas'); | |
const ctx = canvas.getContext('2d'); | |
const SIZE = 640; | |
canvas.width = canvas.height = SIZE; |
I hereby claim:
To claim this, I am signing this object:
g=a=>`:goose-${a}:`;[g('top'),...Array(+prompt('Length of goose neck:')).fill(g('middle')),g('bottom')].join`\n` |
<canvas style="position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);"></canvas> | |
<script> | |
/* | |
w - The width of the canvas in pixels. | |
h - The height of the canvas in pixels. | |
s - The size of the character in pixels. | |
c - The canvas element. | |
t - The graphics context. | |
u - The available colors. | |
q - The player's current colors. |
Make sure to use styles!
Rules of the game:
Each player draws five cards (either rock, paper, or scissors) from an unlimited deck. Both players will pick one card, and if one player's cards beat the other (rock beats scissors, paper beats rock, scissors beats paper) then that player wins. If there is a tie (e.g. both play rock) then whoever has more of the chosen card in the hand wins. If they both have the same amount, it is counted as a tie.
As an extra challenge, modify the game so that there are 5 rounds, with a point being awarded each time a player wins. At the end of the five rounds, print the status of the game (either a win, tie, or a loss).
Create an input with type="date"
. When a button is pressed, the program should write "You are $(age) years old" into a paragraph
element. Replace $(age) with the number of years since the date entered.
Use the MDN Docs for the Date object to complete this assignment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
You can get a date object from the input by doing new Date(input.value)
.
For all assignments, make sure to clearly label your local and global variables. Use functions to make your code more easy-to understand.
Create an application with an input field and a submit field. When the submit button is pressed, the text in the input should be added to a "shopping cart" (an unordered list). This is similar to your wishlist application. Try not to just copy code from the wishlist project, as there's literally no point in cheating on this.
Create 5 buttons labelled "red", "blue", "green", "white", and "black". When pressed, the background of a div element
{ | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "module", | |
"ecmaFeatures": { | |
"jsx": true | |
} | |
}, | |
"parser": "@typescript-eslint/parser", | |
"plugins": [ |