Compare commits
2 Commits
340107bf90
...
afada3e8e7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afada3e8e7 | ||
|
|
de4fbfcdd8 |
88
README.md
88
README.md
@@ -1,73 +1,39 @@
|
|||||||
# React + TypeScript + Vite
|
# Evolution
|
||||||
|
|
||||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
A collection of interactive mini-applications demonstrating genetic algorithms, neural evolution, and AI learning techniques.
|
||||||
|
|
||||||
Currently, two official plugins are available:
|
**Live Demo:** [https://evolution.peterstockings.com/](https://evolution.peterstockings.com/)
|
||||||
|
|
||||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
## About
|
||||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
||||||
|
|
||||||
## React Compiler
|
This project features several mini-apps that showcase evolutionary algorithms and neural networks:
|
||||||
|
|
||||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
- **Snake AI**: Watch neural networks learn to play Snake through evolution
|
||||||
|
- **Self-Driving Car**: AI learns to navigate a race track using genetic algorithms
|
||||||
|
- **Lunar Lander**: Evolutionary training for optimal lunar landing with gimballed thrust control
|
||||||
|
- **Image Approximation**: Genetic algorithm that evolves shapes to approximate a target image
|
||||||
|
- **NEAT Arena**: Neural evolution of augmenting topologies in a competitive environment
|
||||||
|
- **Rogue Gen**: Procedural dungeon generation using evolutionary techniques
|
||||||
|
|
||||||
## Expanding the ESLint configuration
|
## Setup
|
||||||
|
|
||||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
### Prerequisites
|
||||||
|
- [Bun](https://bun.sh/) runtime
|
||||||
|
|
||||||
```js
|
### Installation
|
||||||
export default defineConfig([
|
|
||||||
globalIgnores(['dist']),
|
|
||||||
{
|
|
||||||
files: ['**/*.{ts,tsx}'],
|
|
||||||
extends: [
|
|
||||||
// Other configs...
|
|
||||||
|
|
||||||
// Remove tseslint.configs.recommended and replace with this
|
```bash
|
||||||
tseslint.configs.recommendedTypeChecked,
|
# Install dependencies
|
||||||
// Alternatively, use this for stricter rules
|
bun install
|
||||||
tseslint.configs.strictTypeChecked,
|
|
||||||
// Optionally, add this for stylistic rules
|
|
||||||
tseslint.configs.stylisticTypeChecked,
|
|
||||||
|
|
||||||
// Other configs...
|
# Run development server
|
||||||
],
|
bun run dev
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
# Type check
|
||||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
bun run typecheck
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
# Build for production
|
||||||
// other options...
|
bun run build
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
The development server will start at `http://localhost:5173`
|
||||||
|
|
||||||
```js
|
|
||||||
// eslint.config.js
|
|
||||||
import reactX from 'eslint-plugin-react-x'
|
|
||||||
import reactDom from 'eslint-plugin-react-dom'
|
|
||||||
|
|
||||||
export default defineConfig([
|
|
||||||
globalIgnores(['dist']),
|
|
||||||
{
|
|
||||||
files: ['**/*.{ts,tsx}'],
|
|
||||||
extends: [
|
|
||||||
// Other configs...
|
|
||||||
// Enable lint rules for React
|
|
||||||
reactX.configs['recommended-typescript'],
|
|
||||||
// Enable lint rules for React DOM
|
|
||||||
reactDom.configs.recommended,
|
|
||||||
],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
// other options...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
])
|
|
||||||
```
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { StrictMode } from 'react'
|
import { StrictMode } from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import { HashRouter } from 'react-router-dom'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App.tsx'
|
import App from './App.tsx'
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<BrowserRouter>
|
<HashRouter>
|
||||||
<App />
|
<App />
|
||||||
</BrowserRouter>
|
</HashRouter>
|
||||||
</StrictMode>,
|
</StrictMode>,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user