Skip to content
Snippets Groups Projects
Commit fab140a3 authored by KaspHell's avatar KaspHell
Browse files

save before tensorflow

parent cf78a46b
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,9 @@ class GameUI extends Component {
constructor(props) {
super(props);
this.state = {
result: "default"
result: "default",
userChoice: "default",
aiChoice: "default"
}
this.getAiChoice = this.getAiChoice.bind(this);
}
......@@ -19,9 +21,13 @@ class GameUI extends Component {
}
handlePlay(userChoice){
const aiChoice = this.getAiChoice();
this.setState ({
userChoice: userChoice,
aiChoice: aiChoice
})
console.log("...............");
console.log(userChoice);
const aiChoice = this.getAiChoice();
console.log(aiChoice);
switch (userChoice + aiChoice) {
case "RockRock":
......@@ -50,14 +56,13 @@ class GameUI extends Component {
result: "lose"
})
break;
}
}
render() {
return (
<div>
<Match />
<Scores />
<Match match={this.state}/>
<Scores result={this.state.result}/>
<div className="choices">
<div className="choice" id="r" onClick={() => this.handlePlay("Rock")}>
<img src="https://img.icons8.com/ios/100/000000/paper-waste.png" alt=""/>
......
import React, {Component} from 'react';
class Match extends Component {
constructor() {
super()
constructor(props) {
super(props)
this.state = {
id: 1,
user: null,
ai: null,
result: null
userChoice: this.props.match.userChoice,
aiChoice: this.props.match.aiChoice,
result: this.props.match.result
}
}
......@@ -15,6 +15,13 @@ class Match extends Component {
return(
<div>
<h1>MATCH {this.state.id}</h1>
<table>
</table>
<div>
<h2>User: {this.props.match.userChoice}</h2>
<h2>Result: {this.props.match.result}</h2>
<h2>AI: {this.props.match.aiChoice}</h2>
</div>
</div>
)
}
......
......@@ -4,11 +4,11 @@ class Result extends Component {
constructor(props){
super(props)
this.state = {
result: props.result
result: this.props.result
}
}
render(){
switch (this.state.result) {
switch (this.props.result) {
case "default":
return(
<div />
......@@ -43,7 +43,7 @@ class Result extends Component {
</div>
)
break;
case "lost":
case "lose":
return (
<div>
<p>You lost!</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment