This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ENTER YOUR FIRST AND LAST NAME: */ | |
| /* TO COMPILE: gcc -Wall -ansi -o prog Group1.c */ | |
| /* TO RUN, ENTER SIZE OF BAG */ | |
| /* FOR EXAMPLE: ./prog 10 */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <assert.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <assert.h> | |
| struct Link { | |
| int value; | |
| struct Link * next; | |
| }; | |
| struct ListStack { | |
| struct Link * sentinel; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <assert.h> | |
| #define TYPE int | |
| struct List { | |
| TYPE val; | |
| struct List* prev; | |
| struct List* next; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "../lib/runtime.glsl" | |
| #include "../lib/noise.glsl" | |
| #include "../lib/space.glsl" | |
| #include "../lib/patterns.glsl" | |
| float shape(in vec2 st) { | |
| return sqrt((st.x * st.x) + (st.y * st.y)); | |
| } | |
| float lerp(float a, float b, float x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data List a = Cons a (List a) | Nil | |
| listA = Cons 0 (Cons 2 (Cons 4 Nil)) | |
| listB = Cons 1 (Cons 0 (Cons 1 Nil)) | |
| tentothe :: Double -> Double | |
| tentothe m = 10 ** m | |
| reduce :: List Double -> Double -> Double | |
| reduce (Cons n Nil) m = n * (tentothe m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Used kernel convolution thinking to solve this one. Take a look! | |
| function linkedList(arr) { | |
| const consLinkedList = value => { return {value: value, next_node: null} } | |
| let head; | |
| let curr; | |
| for (const a of arr) { | |
| if (head == undefined) { | |
| head = consLinkedList(a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SPI.h> | |
| #include <Wire.h> | |
| #include <Adafruit_GFX.h> | |
| #include <Adafruit_SSD1306.h> | |
| #define SCREEN_WIDTH 128 // OLED display width, in pixels | |
| #define SCREEN_HEIGHT 32 // OLED display height, in pixels | |
| // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) | |
| #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo chmod a+rw /dev/ttyUSB0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| homomorphism :: (a -> b) -> a -> b | |
| homomorphism f a b = f (x * y) == f x <> f y | |
| where f :: a -> b | |
| x = someElement a | |
| y = someElement a | |
| (*) = operation a | |
| (<>) = operation b | |
| homomorphism (\x -> 2 * x) integers evenIntegers | |
| -- Outputs: True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint | |
| board = [] | |
| for x in range(5): | |
| board.append(["O"] * 5) | |
| def print_board(board): | |
| for row in board: | |
| print " ".join(row) |