Commit 48b2f308 authored by Kai Brandes's avatar Kai Brandes

added wasm solutions for 4

parent 28fff7fa
import React from "react";
import * as wasm from "adventofcode_2017";
export class Day4 extends React.Component {
constructor(props) {
super(props);
this.state = {
a: null,
b: null
};
this.resultA = this.resultA.bind(this);
this.resultB = this.resultB.bind(this);
}
resultA(event) {
this.setState({a: wasm.calc_day_4_a(event.target.value)});
}
resultB(event) {
this.setState({b: wasm.calc_day_4_b(event.target.value)});
}
render() {
return (
<div>
<h1><a href="https://adventofcode.com/2017/day/4" target="_blank">Day 4</a></h1>
<div>
<h2>a</h2>
<textarea cols={50} rows={10} type="text" onInput={this.resultA} defaultValue={"aa bb cc dd aa\naa bb cc dd aaa\n"}/>
Result: {this.state.a}
</div>
<div>
<h2>b</h2>
<textarea cols={50} rows={10} type="text" onInput={this.resultB} defaultValue={"bqs bqs dbutvgf mmzb izpyud rap izpyud xlzeb mnj hjncs\ncirkjq nmjuu xtgejv gtexvj vjcmtqq unjmu\nofbh bdrsk rdrjj elaxvk jrjdr\n"}/>
Result: {this.state.b}
</div>
</div>
);
}
}
\ No newline at end of file
import {Day1} from './components/day1';
import {Day2} from './components/day2';
import {Day3} from './components/day3';
import {Day4} from './components/day4';
import React from "react";
import ReactDOM from "react-dom";
......@@ -9,6 +10,7 @@ export function render() {
ReactDOM.render([
React.createElement(Day1),
React.createElement(Day2),
React.createElement(Day3)
React.createElement(Day3),
React.createElement(Day4)
], solutions);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment