This file contains hidden or 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
| // Omitting headers | |
| using namespace std; | |
| void MatrixMultiply( | |
| const vector<vector<uint64_t>>& source_mat1, | |
| const vector<vector<uint64_t>>& source_mat2, | |
| int N, | |
| vector<vector<uint64_t>>* dest_mat) { | |
| for (int i = 0; i < N; ++i) { |
This file contains hidden or 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
| using namespace std; | |
| static int op_counter = 0; | |
| void Move(vector<int>* state, | |
| int pos, int zero_pos) { | |
| ++op_counter; | |
| assert(state->at(zero_pos) == 0); | |
| assert(state->at(pos) != 0); | |
| cout << "Moved '" << state->at(pos) << "' from " |
This file contains hidden or 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
| (defpackage :game-of-life | |
| (:use :cl)) | |
| (in-package :game-of-life) | |
| (defparameter *board-size* 10) | |
| (defparameter *game-board* nil) | |
| (defparameter *space* #\ ) | |
| (defparameter *life* #\#) |
This file contains hidden or 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
| ;;; Useful helpers to add stuff to the board. Describe a pattern as a list. | |
| (defun add-life (x y) | |
| (setf (aref *game-board* y x) 1)) | |
| (defun draw-pattern (x y pattern) | |
| "Assuming 'pattern' is specified as a row-major set of 1s and 0s, replicates that on the board" | |
| (mapindex #'(lambda (row-num row) | |
| (mapindex #'(lambda (col-num entry) | |
| (let ((x-eff (+ x col-num)) |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| const ( | |
| NameCmd int = iota | |
| PingCmd int = iota |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| const ( | |
| NameCmd int = iota | |
| PingCmd int = iota |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| type Bignum struct { | |
| digits []*Digit | |
| add chan<- bool | |
| stable chan bool | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "bufio" | |
| "flag" | |
| "fmt" | |
| "log" | |
| "math" | |
| "os" | |
| ) |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| type Node struct { | |
| val uint8 | |
| next *Node | |
| visited bool | |
| cycle int | |
| } |
This file contains hidden or 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
| package main | |
| import "fmt" | |
| import "math" | |
| type Stick struct { | |
| id int | |
| x1, y1, x2, y2 float64 | |
| } |
OlderNewer