Skip to content

Commit 857aa59

Browse files
done for now
1 parent ad9b5e3 commit 857aa59

File tree

8 files changed

+98
-12
lines changed

8 files changed

+98
-12
lines changed

Diff for: react-frontend/.gitignore

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
firebase-debug.log*
8+
firebase-debug.*.log*
9+
10+
# Firebase cache
11+
.firebase/
12+
13+
# Firebase config
14+
15+
# Uncomment this if you'd like others to create their own Firebase project.
16+
# For a team working on the same Firebase project(s), it is recommended to leave
17+
# it commented so all members can deploy to the same project(s) in .firebaserc.
18+
# .firebaserc
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
32+
# nyc test coverage
33+
.nyc_output
34+
35+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
36+
.grunt
37+
38+
# Bower dependency directory (https://bower.io/)
39+
bower_components
40+
41+
# node-waf configuration
42+
.lock-wscript
43+
44+
# Compiled binary addons (http://nodejs.org/api/addons.html)
45+
build/Release
46+
47+
# Dependency directories
48+
node_modules/
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env

Diff for: react-frontend/src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Visualizer from './components/visualizer'
66
function App() {
77
const [arrOfCalls, setArrOfCalls] = useState([])
88
const [funcName, setFuncName] = useState("")
9-
const [renderSpeed, setRenderSpeed] = useState(500)
9+
const [renderSpeed, setRenderSpeed] = useState(600)
1010
const [isRunning, setIsRunning] = useState(false)
1111
const [isLoading, setIsLoading] = useState(false)
1212
const [jelly, setJelly] = useState(false)

Diff for: react-frontend/src/components/controls.tsx

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
22
import React from "react";
3-
import { Button } from "@material-ui/core";
3+
import { Button, Slider } from "@material-ui/core";
44
import Switch from '@material-ui/core/Switch';
55
import FormControlLabel from '@material-ui/core/FormControlLabel';
66
import "./controls.css";
@@ -11,6 +11,10 @@ const Controls = (props: any) => {
1111
props.setJelly(!props.jelly)
1212
}
1313

14+
const onSlide = (e: any, newValue: number | number[]) => {
15+
props.setRenderSpeed(newValue)
16+
}
17+
1418
return (
1519
<div className="ControlPanel">
1620
<Button
@@ -33,7 +37,6 @@ const Controls = (props: any) => {
3337
{" "}
3438
Instructions + Reset{" "}
3539
</Button>
36-
3740

3841
<FormControlLabel
3942
style={{marginLeft: "10px", marginTop: "10px"}}
@@ -44,6 +47,15 @@ const Controls = (props: any) => {
4447
/>}
4548
label="Jelly"
4649
/>
50+
51+
<Slider
52+
defaultValue={50}
53+
aria-labelledby="discrete-slider-always"
54+
step={1}
55+
valueLabelDisplay="on"
56+
onChange={onSlide}
57+
min={10}
58+
/>
4759
</div>
4860
);
4961
};

Diff for: react-frontend/src/components/placeholder.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Typography from "@material-ui/core/Typography";
66

77
const useStyles = makeStyles({
88
root: {
9-
maxWidth: 593
9+
maxWidth: 593,
1010
},
1111
bullet: {
1212
display: "inline-block",
@@ -25,7 +25,11 @@ export default function OutlinedCard() {
2525
const classes = useStyles();
2626

2727
return (
28-
<Card className={classes.root} variant="outlined" style={{marginLeft: "auto", marginRight: "auto", marginTop: "50px"}}>
28+
<Card
29+
className={classes.root}
30+
variant="outlined"
31+
style={{ marginLeft: "auto", marginRight: "auto", marginTop: "50px" }}
32+
>
2933
<CardContent>
3034
<Typography variant="h4" component="h2">
3135
Instructions
@@ -68,7 +72,8 @@ export default function OutlinedCard() {
6872
>
6973
- If all goes well, you will see a nice recursive visualization of
7074
your function <br />
71-
- Green node == initial call. Red node == recursive call. Blue node == base case. <br />
75+
- Green node == initial call. Red node == recursive call. Blue node ==
76+
base case. <br />
7277
- Turn 'Jelly' off for a static graph <br />- Click on any Node and
7378
view it's return value
7479
</Typography>
@@ -77,10 +82,10 @@ export default function OutlinedCard() {
7782
<iframe
7883
width="560"
7984
height="315"
80-
src="https://www.youtube.com/embed/QwUZxCBtfLw"
85+
src="https://www.youtube.com/embed/-7rJv-yiTzc"
86+
frameBorder="0"
8187
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
8288
allowFullScreen
83-
frameBorder = "0"
8489
></iframe>
8590
</CardContent>
8691
</Card>

Diff for: react-frontend/src/components/userinput.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99

1010
const UserInput = (props: any) => {
1111
const [submittedCode, setCode] = useState(
12-
"# DO NOT include any 'print(...)' statements!"
12+
"# DO NOT include any 'print(...)' statements! \n\ndef fib(x):\n if x == 1 or x == 2:\n return 1\n return fib(x - 1) + fib(x - 2)\n\nfib(10)"
1313
);
1414

1515
const runCode = async () => {
@@ -46,7 +46,7 @@ const UserInput = (props: any) => {
4646
try {
4747
// send HTTP request to flask server and store
4848
// response inside callTrace
49-
const domain = "https://recursion0r94s8df984.herokuapp.com";
49+
const domain = "<BACKEND URL REMOTE CODE RUNNER>";
5050

5151
const options = `/execute?funcName=${functionName}&funcCall=${functionCall[0]}`;
5252
const fetchConfig = {
@@ -92,6 +92,7 @@ const UserInput = (props: any) => {
9292
setArrOfCalls={props.setArrOfCalls}
9393
jelly={props.jelly}
9494
setJelly={props.setJelly}
95+
setRenderSpeed={props.setRenderSpeed}
9596
/>
9697
</Fragment>
9798
);

Diff for: react-frontend/src/components/visualizer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Visualizer = (props) => {
1212
*/
1313
const funcName = props.name
1414
const callTrace = props.callTrace
15-
const ANIMATION_SPEED = props.renderSpeed; // milliseconds per interval
15+
const ANIMATION_SPEED = 1100 - props.renderSpeed * 10; // milliseconds per interval
1616
const [graphState, setGraphState] = useState({
1717
nodes: [],
1818
links: []

Diff for: remote-code-runner/app.py

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def execute():
2020
funcName = request.args['funcName']
2121
funcCall = request.args['funcCall']
2222
if funcName != funcCall[:len(funcName)]:
23+
print(funcName)
24+
print(funcCall[:len(funcName)] != funcName)
2325
return "Check and make sure you defined EXACTLY one function.", 400
2426
body = str(request.data)
2527
inputCode = pi.parseInput(body)

Diff for: remote-code-runner/tryget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55

66

7-
API_KEY = os.environ.get('API_KEY')
7+
API_KEY = os.environ.get('API_KEY')
88

99
def tryGet(token):
1010
time.sleep(10)

0 commit comments

Comments
 (0)