{{ message }}

Instantly share code, notes, and snippets.

# Craig Rodrigues CraigRodrigues

Last active Jun 2, 2016
My solution to CS50 pset2 - "Hail, Caesar!" (using function)
View caesar2.c
 #include #include #include #include /** * Caesar.c * A program that encrypts messages using Caesar’s cipher. Your program must * accept a single command-line argument: a non-negative integer. Let’s call it * k for the sake of discussion. If your program is executed without any
Created Jun 3, 2016
My solution to CS50 Hacker pset1 - "Bad Credit " (printf tests included)
View credit2.c
 #include #include #include #include #include // calculates the number of digits in the card number int getCardDigits(long long card_num) { int card_digits = (int)log10(card_num) + 1;
Created Jun 8, 2016
CS50 pset3 - "Game of Fifteen" - Linear Search Algorithm
View helpers.c
 /** * helpers.c * * Computer Science 50 * Problem Set 3 * * Helper functions for Problem Set 3. */ #include
Last active Jun 10, 2016
CS50 pset3 - "Game of Fifteen" - Helpers - Insertion Sort & Binary Search (Recursion)
View helpers2.c
 /** * helpers.c * * Computer Science 50 * Problem Set 3 * * Helper functions for Problem Set 3. */ #include
Created Jun 13, 2016
Recursive Sum Function
View sum.c
 //n is the last index of the array int arr_sum(int arr[], int n ) { //base case if (n == 0) { return arr[0]; } return (arr[n] + arr_sum(arr,n-1));
Last active Jun 13, 2016
Finding Max Value with Recursion
View max.c
 #include "stdio.h" // find the max number in a list/array // n is the last index of the array int arr_max(int arr[], int max, int n) { //base case if (n == 0) {
Last active Jun 13, 2016
Recursive Counting Function
View counting.c
 #include "stdio.h" //n is the last index of the array int arr_count(int count, int n) { //base case if (n == 0) { return count;
Last active Jun 19, 2016
[2016-06-13] Challenge #271 [Easy] Critical Hit
View critical.c
 #include #include #include /* [2016-06-13] Challenge #271 [Easy] Critical Hit * http://bit.ly/1sLH0bn * * Critical hits work a bit differently in this RPG. If you roll the maximum value on a die, you * get to roll the die again and add both dice rolls to get your final score. Critical hits can * stack indefinitely -- a second max value means you get a third roll, and so on. With enough
Last active Jun 22, 2016
Codecademy Javascript Unit 2 - Rock, Paper, Scissors
View RPS.js
 var userChoice = prompt("Do you choose rock, paper or scissors?"); var computerChoice = Math.random(); if (computerChoice < 0.34) { computerChoice = "rock"; } else if (computerChoice <= 0.67) { computerChoice = "paper"; } else { computerChoice = "scissors"; } console.log("Computer: " + computerChoice);
Last active Jul 7, 2016
[2016-06-20] Challenge #272 [Easy] What's in the bag?
View bag.c
 #include #include #include #include int main (void) { int tilecount[] = { 9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1, 0, 0, 0, 0, 2 };