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
/** | |
* Non-recursive IDA* search (pseudocode). | |
* @param cube A scrambled cube to solve. | |
*/ | |
vector<uint8_t> idaStar(RubiksCube& cube) | |
{ | |
// Holds a copy of the cube, a move (L, R, etc.), and the search depth. | |
struct Node | |
{ | |
RubiksCube cube; |
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 render() { | |
ctx.beginPath(); | |
ctx.lineWidth = 2; | |
while (pointQueue.length > 1) { | |
const lastPoint = pointQueue.shift(); | |
const curPoint = pointQueue[0]; | |
// Render a line segment from lastPoint to curPoint, but mirrored in each | |
// quadrant. |
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 render() { | |
ctx.beginPath(); | |
ctx.lineWidth = 2; | |
while (pointQueue.length > 1) { | |
const lastPoint = pointQueue.shift(); | |
const curPoint = pointQueue[0]; | |
// First line: The line under the cursor. | |
ctx.resetTransform(); |
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(window, gl) { | |
'use strict'; | |
// The canvas element and a 2D rendering context. | |
const easel = document.getElementById('easel'); | |
const ctx = easel.getContext('2d'); | |
// This point (vec2) holds the first point in the drawing. Transformations | |
// happen about this point. | |
let startPoint = 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
class Rectangle { | |
constructor(gl, color, width, height) { | |
this.gl = gl; | |
this.color = color; | |
this.width = width; | |
this.height = height; | |
// Rotation, updated before each render. | |
this.rotation = gl.mat2d.create(); |
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
class Rectangle { | |
constructor(gl, color, width, height) { | |
this.gl = gl; | |
this.color = color; | |
this.width = width; | |
this.height = height; | |
// Rotation, updated before each render. | |
this.rotation = gl.mat2d.create(); |
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
class Rectangle { | |
constructor(gl, color, width, height) { | |
this.gl = gl; | |
this.color = color; | |
this.width = width; | |
this.height = height; | |
// Rotation, updated before each render. | |
this.rotation = gl.mat2d.create(); |
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
class Rectangle { | |
constructor(gl, color, width, height) { | |
this.gl = gl; | |
this.color = color; | |
this.width = width; | |
this.height = height; | |
// Rotation, updated before each render. | |
this.rotation = gl.mat2d.create(); |
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
class Rectangle { | |
constructor(gl, color, width, height) { | |
this.gl = gl; | |
this.color = color; | |
this.width = width; | |
this.height = height; | |
this.rotation = gl.mat2d.create(); | |
} |
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 <cstddef> | |
using std::size_t; | |
#include <array> | |
using std::array; | |
#include <bitset> | |
using std::bitset; | |
#include <iostream> | |
using std::cout; | |
using std::endl; |
NewerOlder