Skip to content

Instantly share code, notes, and snippets.

View lettergram's full-sized avatar
🕶️
Loading...

Austin Walters lettergram

🕶️
Loading...
View GitHub Profile
#include <stdio.h>
void printArray(int * array, int size){
int i;
printf("[ ");
for (i = 0; i < size; i++)
printf("%d ", array[i]);
printf("]\n");
}
# (Index * 5 seconds) + (20 seconds * (Index - PrevIndex))
# If previous elevators loops/stops add up to be greater than,
# (timePerFloor * 2) + timePerWait, then increase floor of previous
# elevators loop. i.e. elevator[2]+=1
# e represents elevatorArray
def addFloor(e):
best = 99999
for i in range(1, len(e)):
cirTime, avgCarry = eleLoop(e, i)
if cirTime + ((cirTime / 100) * avgCarry) < best:
# Allocate elevators
# Elevator[] represents the starting
# group of stops.
def elevatorAllocation(building, elevatorCount):
elevator = []
for i in range(elevatorCount + 1):
elevator.append(0)
for i in range(1, floorCount):
elevator = addFloor(elevator)
printeleLoop(elevator)
# Sets up the building, filling all the floors with people
def fillBuilding():
building = []
for i in range(floorCount - 1):
building.append(peoplePerFloor)
return building
# Determines the time for circuit (cirTime),
# as well as average carrying capacity per circuit.
# Given e - array of elevators, which holds the highest
class javaScriptHandler : public QObject {
Q_OBJECT
public slots:
Q_INVOKABLE void webElement(QString str);
public:
javaScriptHandler();
void injectJavaScript(QWebFrame *);
// Note: javaScriptHandler * api is a variable in the MainWindow class
void MainWindow::on_webView_loadProgress(int progress){
ui->urlLineEdit->setVisible(false);
ui->progressBar->setValue(progress);
QWebFrame * frame= ui->webView->page()->mainFrame();
if(progress == 100){
function clickHandler(e){
var alertString, elem, evt = e ? e:event;
if (evt.srcElement) {
elem = evt.srcElement;
}else if (evt.target) {
elem = evt.target;
}
alertString = 'Tag=<'+ elem.tagName + '>';
if(elem.hasAttribute('id')) {
alertString += '\\nId=' + elem.getAttribute('id');
class Generate{
public:
Generate();
void push(std::string);
std::string pop();
void outPut();
Generate::Generate(){
objects = new std::queue<std::string>;
}
void Generate::push(std::string obj){
std::cout << "Size: " << objects->size() << std::endl;
std::cout << "Pushing:\n" << obj << std::endl;
objects->push(obj);
}
#include "generate.h"
class javaScriptHandler : public QObject {
Q_OBJECT
public slots:
Q_INVOKABLE void webElement(QString);
public:
javaScriptHandler();