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
CreateUserEvent, id: 1, username: test, password: test | |
CreateAccountEvent, id: 1, user_id: 1, balance: 0 | |
CreateUserEvent, id: 2, username: test2, password: test2 | |
CreateAccountEvent, id: 2, user_id: 2, balance: 0 | |
DepositEvent, account_id: 1, amount: 100 | |
DepositEvent, account_id: 2, amount: 100 | |
WithdrawEvent, account_id: 1, amount: 75 | |
WithdrawEvent, account_id: 2, amount: 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
# robot thing - Josh Sandlin | |
def prompt(*args) | |
print(*args) | |
gets.chomp | |
end | |
name = prompt("What's your name? ") | |
age = prompt("How old are you? ") |
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
var billMurray = { | |
name: "Bill Murray", | |
age: 65, | |
movies: [ | |
'Caddy Shack', | |
'Lost in Translation', | |
'Ghost Busters' | |
], | |
show: function () { | |
return ` |
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
// theory of tic tac toe win discovery | |
// | |
// | 2 | 7 | 6 | | |
// | 9 | 5 | 1 | | |
// | 4 | 3 | 8 | | |
// | |
// this forms a "magic square" where each | |
// row, column, or diagonal adds up to 15 | |
// | |
// as players make moves, the values of |
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
var result; | |
var max = 20; | |
function fizzbuzz (x) { | |
if (x % 15 === 0) { | |
return 'fizzbuzz'; | |
} else if (x % 3 === 0) { | |
return 'fizz'; | |
} else if (x % 5 === 0) { | |
return 'buzz'; |
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
// | a | b | c | | |
// | d | e | f | | |
// | g | h | i | | |
// | |
// sometimes either the player or the computer end up playing an undefined move, which | |
// is weird. I think it has something to do with the repeat handling. If a player or | |
// the computer mark a spot that has already been marked, the respective input functions | |
// recurse back and repeat the process, though it doesn't register with the main loop | |
// that a different input was sent.... sometimes. Sometimes it works, sometimes it doesn't |
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
// The goal here is to write fizzbuzz in such a | |
// way that adding new rules is as easy as defining | |
// a new predicate containing a number to check and | |
// return result. | |
// | |
// I want the changes to be easily made, in a single | |
// place, outside of the hard logic of the code | |
// | |
// I also want it so that there is no need for a special | |
// case for multiple predicates matching, e.g. `fizzbuzz` |
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
function sayHello(name) { | |
console.log(`Hello, ${name}`); | |
}; | |
function areBothEven(a, b) { | |
return ((a % 2 == 0) && (b % 2 == 0)) | |
} | |
function hotOrNot(temp) { | |
return (temp > 75) ? "hot" : "not" |
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
// Josh Sandlin <josh@thenullbyte.org> | |
// Code for WDI-Fundamentls Exercises: 6.1.1, 6.2.1, 6.3.1 | |
// Linted with the Standard JS Linter | |
var checkerboard = [ | |
[null, null, null, null, null, null, null, null], | |
[null, null, null, null, null, null, null, null], | |
[null, null, null, null, null, null, null, null], | |
[null, null, null, null, null, null, null, null], | |
[null, null, null, null, null, null, null, null], |
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
nat(z). %% zero | |
nat(Z) :- %% every number after zero is a successor | |
successor(Y, X), nat(Y). | |
successor(s(A), A). | |
%% A + 0 = A | |
natadd(A, z, A). | |
%% s(C) = A + S(B) if C = A + B | |
natadd(A, s(B), s(C)) :- | |
natadd(A, B, C). |