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
def insertNode(root, newNode, data): | |
if root is null: | |
root = newNode | |
root.data = data | |
elif data < root.left: | |
root.left = insertNode(root.left, newNode, data); | |
else: | |
root.right = insertNode(root.right, newNode, data); | |
return root | |
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
int AI::IterativeDeepening(const State& state, int alpha, int beta, int depth) { | |
if (cutoff(state, depth)) | |
return eval(state); | |
int result = 0; | |
for (Move* move : moves) { | |
State newState = state.clone(); | |
result = max(result, newState.makeMove(state)); | |
} | |
return result; | |
} |
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
/** | |
* Gio Borje | |
* 41894135 | |
*/ | |
#include "HashMap.h" | |
using namespace std; | |
/** | |
* Initializes the node with the specified parameters |
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
#ifndef BOARD_CONFIG_H | |
#define BOARD_CONFIG_H | |
class BoardConfig { | |
public: | |
unsigned int rows; | |
unsigned int cols; | |
unsigned int kLength; | |
bool gravityFlag; |
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
def analyze(other, weights): | |
return reduce(lamda base, items: base + items[0] * items[1], zip(other, weights), 0) | |
def friend_zone(other): | |
friend_zone_dict[other] = True | |
def FriendZone(): | |
while date_is_ongoing: | |
certainty_of_others_feelings_of_me = analyze(other) | |
if certainty_of_others_feelings_of_me >= threshold_of_romantic_felings: |
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
CppCKPlayer player = new CppCKPlayer(dllNameStr, playerInt, BoardModel model); | |
while (!game.isEnd()) { | |
// Opponent makes a move | |
Cell cell; | |
cell.row = opponentMove.row; | |
cell.col = opponentMove.col; | |
Mark m = (opponentMove.mark == 'X') ? Mark.A : Mark.B; | |
player.updateBoard(cell, mark); | |
Cell c = player.getMove(); |
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
Sorted List Tests Running | |
========================= | |
canAdd SUCCESS | |
canIterate SUCCESS | |
canClear SUCCESS | |
canPrintReverse SUCCESS | |
canPrintStrings SUCCESS | |
canCopy SUCCESS | |
canAssign SUCCESS |
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
LinearClassify(w, b, x): | |
""" Computes a class of a two-class classifier using an n - 1 dimensional hyperplane """ | |
dot_product = sum(i * j for i, j in zip(w, x)) | |
if dot_product > b: | |
return 1 | |
else: | |
return 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
def CreateTree(half_width): | |
for i in range(half_width): | |
print(' ' * (half_width - i), '*' * (2 * i - 1)) | |
for i in range(half_width >> 2): | |
print(' ' * (half_width - 1), '+') | |
# CreateTree(6) | |
# * | |
# *** | |
# ***** |
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 <iostream> | |
#include "emmintrin.h" | |
using namespace std; | |
int main(int argc, char* argv[]) { | |
const LENGTH = 1 << 10; | |
const SSE_LENGTH = LENGTH >> 2; | |
// Set constant vectors |
OlderNewer