Skip to content

Commit 553b486

Browse files
committed
added 3 algos under Turing Machine
1 parent c9765de commit 553b486

File tree

9 files changed

+212
-80
lines changed

9 files changed

+212
-80
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ So far there are 6 segments
1919
- Binary Search Game
2020
- Turing Machine
2121

22-
I have implemented a total of `14 algorithms` so far. And will try to add more later.
22+
I have implemented a total of `17 algorithms` so far. And will try to add more later.
2323

2424
## Algorithms implemented
2525

@@ -38,6 +38,10 @@ I have implemented a total of `14 algorithms` so far. And will try to add more l
3838
- Graham Scan for Convex Hull
3939
- Binary Search
4040
- Turing Machine
41+
- Bitwise NOT
42+
- Increment one
43+
- 2's Compliment
44+
4145

4246

4347

src/App.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, {Component} from 'react';
2-
import './TrialPathFinder/firebaseConfig';
32

43
import {HashRouter as Router, Switch, Route} from 'react-router-dom';
54
import Pathfinder from "./pathfinderComponents/pathfinder";
@@ -11,8 +10,7 @@ import ConvexHull from "./convexHullComponents/convexHull";
1110
import BinarySearch from "./binarySearchComponent/binarySearch";
1211
import RecursiveSort from "./recursiveSortComponents/recursiveSort";
1312
import Puzzle from "./15puzzleComponents/puzzle";
14-
import TrialPath from "./TrialPathFinder/pathfinder";
15-
import TrialPathEdit from "./TrialPathFinderEdit/pathfinder";
13+
1614
import TuringMachine from "./Turing Machine/turingMachine";
1715

1816

@@ -39,8 +37,6 @@ class App extends Component {
3937
<Route path='/recursivesort' component={RecursiveSort}/>
4038
<Route path='/turing' component={TuringMachine}/>
4139
<Route path='/15puzzle' component={Puzzle}/>
42-
{/*<Route path='/trial' component={TrialPath}/>*/}
43-
{/*<Route path='/trialedit' component={TrialPathEdit}/>*/}
4440
<Route path='/' component={Home}/>
4541

4642
</Switch>

src/Turing Machine/menu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Menu extends Component {
2525

2626
<button
2727
className='btn btn-warning btn-lg m-2'
28-
// onClick={this.props.onViusalize}
28+
onClick={this.props.onReset}
2929
disabled={this.props.disable}
3030
>Reset</button>
3131

src/Turing Machine/navbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Navbar extends Component {
55
render() {
66
return (
77
<nav className="navbar navbar-expand-lg navbar-dark bg-dark">
8-
<span className="navbar-brand">Recursive Sorting Visualizer</span>
8+
<span className="navbar-brand">Turing Machine</span>
99
<button className="navbar-toggler" type="button" data-toggle="collapse"
1010
data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
1111
aria-expanded="false" aria-label="Toggle navigation">

src/Turing Machine/simpleSelect.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ const SimpleSelect = (props) => {
3636
labelId="demo-simple-select-label"
3737
id="demo-simple-select"
3838
value={age}
39-
// onChange={handleChange}
39+
onChange={handleChange}
4040
>
4141
<MenuItem value={0} style={{selected:true}} >Bitwise NOT</MenuItem>
4242
<MenuItem value={1} style={{selected:true}} >Add One</MenuItem>
4343
<MenuItem value={2} style={{selected:true}} >2's Compliment</MenuItem>
44-
<MenuItem value={3} style={{selected:true}} >Bitwise AND</MenuItem>
45-
<MenuItem value={4} style={{selected:true}} >Bitwise OR</MenuItem>
44+
{/*<MenuItem value={3} style={{selected:true}} >Bitwise AND</MenuItem>*/}
45+
{/*<MenuItem value={4} style={{selected:true}} >Bitwise OR</MenuItem>*/}
4646
</Select>
4747
</FormControl>
4848
</div>

src/Turing Machine/table.jsx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, {Component} from 'react';
2+
import Rect from "../recursiveSortComponents/rect";
3+
4+
class Table extends Component {
5+
render() {
6+
console.log(this.props.data)
7+
return (
8+
<div>
9+
<table className="table table-bordered">
10+
<thead>
11+
<tr>
12+
<th scope="col">State</th>
13+
<th scope="col">Input</th>
14+
<th scope="col">Next</th>
15+
<th scope="col">Output</th>
16+
<th scope="col">Direction</th>
17+
</tr>
18+
</thead>
19+
<tbody>
20+
{this.props.data.map( (row,rowidx)=>{
21+
return (
22+
<tr className={ rowidx===this.props.state && 'table-primary' }>
23+
<th scope="row">{row[0]}</th>
24+
<th>{row[1]}</th>
25+
<td>{row[2]}</td>
26+
<td>{row[3]}</td>
27+
<td>{row[4]}</td>
28+
</tr>
29+
);
30+
} )}
31+
{/*<tr>*/}
32+
{/* <th scope="row">1</th>*/}
33+
{/* <td>Mark</td>*/}
34+
{/* <td>Otto</td>*/}
35+
{/* <td>@mdo</td>*/}
36+
{/*</tr>*/}
37+
{/*<tr>*/}
38+
{/* <th scope="row">2</th>*/}
39+
{/* <td>Jacob</td>*/}
40+
{/* <td>Thornton</td>*/}
41+
{/* <td>@fat</td>*/}
42+
{/*</tr>*/}
43+
{/*<tr>*/}
44+
{/* <th scope="row">3</th>*/}
45+
{/* <td colSpan="2">Larry the Bird</td>*/}
46+
{/* <td>@twitter</td>*/}
47+
{/*</tr>*/}
48+
</tbody>
49+
</table>
50+
</div>
51+
);
52+
}
53+
}
54+
55+
export default Table;

0 commit comments

Comments
 (0)