This file contains 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
--[[ | |
Holds a collection of frames that switch depending on how much time has | |
passed. | |
]] | |
Animation = Class{} | |
function Animation:init(params) | |
self.texture = params.texture |
This file contains 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
--[[ | |
This is CS50 2019. | |
Games Track | |
Pong | |
-- Ball Class -- | |
Author: Colton Ogden | |
[email protected] |
This file contains 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
# TODO START | |
from cs50 import SQL | |
from csv import reader | |
from sys import argv | |
if len(argv) != 2: | |
print(f"USAGE: {argv[0]} csv_file_name") | |
exit() | |
db = SQL("sqlite:///students.db") | |
with open(argv[1]) as csvfile: |
This file contains 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
SELECT title FROM movies | |
WHERE year == 2008 |
This file contains 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 sys import argv | |
from csv import reader | |
if len(argv) != 3: | |
print(f"Usage: {argv[0]} Database_File_Name Sequences_File_Name") | |
exit(1) | |
with open(argv[1], "r") as csvfile: | |
reader = list(reader(csvfile)) | |
reader[0].remove("name") | |
main_work = reader[0] |
This file contains 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 cs50 import get_float | |
co = 0 | |
coin_count = 0 | |
while (co <= 0): | |
co = get_float("Change owed: ") | |
co = co * 100 | |
while co >= 25: | |
co -= 25 |
This file contains 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 cs50 import get_int | |
s = 0 | |
while (s < 1 or s > 8): | |
s = get_int("Height: ") | |
blankspaces = s | |
hashes = 0 | |
for i in range(s): | |
blankspaces -= 1 |
This file contains 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 "helpers.h" | |
#include <cs50.h> | |
#include <math.h> | |
// Convert image to grayscale | |
void grayscale(int height, int width, RGBTRIPLE image[height][width]) | |
{ | |
for (int i = 0; i < height; i++) | |
{ | |
for (int j = 0; j < width; j++) |
This file contains 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 <cs50.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <math.h> | |
// Max voters and candidates | |
#define MAX_VOTERS 100 | |
#define MAX_CANDIDATES 9 | |
// preferences[i][j] is jth preference for voter i |
This file contains 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 cs50 import get_string | |
text = get_string("Text: ") | |
numOfLetters = 0 | |
numOfWords = 1 | |
numOfSentences = 0 | |
for i in range(len(text)): | |
if text[i].isalpha(): | |
numOfLetters += 1 | |
elif text[i].isspace(): |
NewerOlder