Skip to content

Instantly share code, notes, and snippets.

View Saarth-Jain's full-sized avatar
🎯
Studying for boards

Saarth22 Saarth-Jain

🎯
Studying for boards
View GitHub Profile
@Saarth-Jain
Saarth-Jain / Animation.lua
Created October 31, 2020 19:06
CS50 Solution pset8 tracks games : mario
--[[
Holds a collection of frames that switch depending on how much time has
passed.
]]
Animation = Class{}
function Animation:init(params)
self.texture = params.texture
@Saarth-Jain
Saarth-Jain / Ball.lua
Created October 31, 2020 15:40
CS50 Solution pset8 game track pong
--[[
This is CS50 2019.
Games Track
Pong
-- Ball Class --
Author: Colton Ogden
[email protected]
@Saarth-Jain
Saarth-Jain / import.py
Created October 27, 2020 09:51
CS50 Solution pset7 houses
# 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:
@Saarth-Jain
Saarth-Jain / 1.sql
Created October 27, 2020 09:49
CS50 Solution pset7 movies
SELECT title FROM movies
WHERE year == 2008
@Saarth-Jain
Saarth-Jain / dna.py
Created October 27, 2020 09:41
CS50 Solution pset6 dna
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]
@Saarth-Jain
Saarth-Jain / cash.py
Last active October 17, 2020 07:33
CS50 solution pset6 cash
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
@Saarth-Jain
Saarth-Jain / mario.py
Created October 17, 2020 07:16
CS50 Solution pset6 mario less comfortable version
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
@Saarth-Jain
Saarth-Jain / helpers.c
Created October 16, 2020 13:04
CS50 Solution pset4 filter less comfortable (helpers.c)
#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++)
@Saarth-Jain
Saarth-Jain / runoff.c
Created October 16, 2020 07:54
CS50 Solution pset3 runoff
#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
@Saarth-Jain
Saarth-Jain / readability.py
Created October 16, 2020 05:43
CS50 Solution pset6 readability in python
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():