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

Change of model

parent 71692ebe
No related branches found
No related tags found
No related merge requests found
import React, { useState, useEffect } from 'react'
import * as tf from '@tensorflow/tfjs'
import * as tmImage from '@teachablemachine/image'
import loadVideo from '../utilities/camera'
function AiCamera() {
// the link to your model provided by Teachable Machine export panel
const URL = 'https://teachablemachine.withgoogle.com/models/Ycxae80Nq/'
//without empty class
//const URL = 'https://teachablemachine.withgoogle.com/models/Ycxae80Nq/'
const URL = 'https://teachablemachine.withgoogle.com/models/zecS4aGk6/'
const [model, setModel] = useState(null)
const [results, setResult] = useState([])
......
......@@ -24,6 +24,9 @@ class GameUI extends Component {
console.log(userChoice)
console.log(aiChoice)
switch (userChoice + aiChoice) {
case "default":
break;
case "RockRock":
case "ScissorsScissors":
case "PaperPaper":
......@@ -34,7 +37,7 @@ class GameUI extends Component {
aiChoice: aiChoice,
id: this.state.id + 1
})
break
break;
case "RockScissors":
case "ScissorsPaper":
......@@ -46,7 +49,7 @@ class GameUI extends Component {
aiChoice: aiChoice,
id: this.state.id + 1
})
break
break;
case "ScissorsRock":
case "PaperScissors":
......@@ -58,7 +61,7 @@ class GameUI extends Component {
aiChoice: aiChoice,
id: this.state.id + 1
})
break
break;
}
}
render() {
......
......@@ -2,9 +2,6 @@ import React, { Component } from 'react';
import './Result.css'
class Result extends Component {
constructor(props){
super(props)
}
render(){
return(
<div>
......
......@@ -12,15 +12,15 @@ class Scores extends Component {
}
update() {
if (this.props.match.result == "Win"){
if (this.props.match.result === "Win"){
this.setState({
userScore: this.state.userScore + 1
})
} else if (this.props.match.result == "Lose") {
} else if (this.props.match.result === "Lose") {
this.setState({
aiScore: this.state.aiScore + 1
})
} else if (this.props.match.result == "Draw") {
} else if (this.props.match.result === "Draw") {
this.setState({
draw: this.state.draw + 1
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment