FediScanner

#react

← Back

I wanted to build something fun, not another CRUD app or chatbot.

So I built Adaptive Hand Cricket: a browser-based game where you play hand cricket through your webcam, your hand gestures are recognized in real time, and the computer gradually becomes harder by combining randomness, live gesture reading, and machine learning.

How it works


The game uses:

  • React + Vite for the frontend
  • MediaPipe for real-time hand landmark detection
  • TensorFlow.js for learning player patterns
  • Webcam input through getUserMedia
  • localStorage to remember previous batting behavior

The supported gestures are:

1 -> index
2 -> index + middle
3 -> index + middle + ring
4 -> index + middle + ring + pinky
5 -> all fingers
6 -> thumb
7 -> thumb + index
8 -> thumb + index + middle
9 -> thumb + index + middle + ring

Instead of simply counting fingers, I classify the exact finger pattern.

The game loop


Every delivery follows:

Computer commits to a move
↓
3
2
1
↓
SHOW
↓
Human gesture is locked
↓
Both moves are revealed
↓
Score / wicket is calculated

This keeps the reveal synchronized like actual hand cricket.

Making the opponent adaptive


A completely random computer got boring quickly, so I added three decision strategies:

RANDOM
ML
PEEK

Difficulty automatically increases with the player's score:

0-39 -> EASY
40-99 -> MEDIUM
100+ -> HARD

Each level changes how often the opponent uses each strategy.

For example:

EASY: {
peekChance: 0.10,
mlChance: 0.30,
randomChance: 0.60
}

Peek strategy


Humans often form their gesture before the countdown reaches zero.

On some deliveries, the computer is secretly allowed to inspect the gesture at a random point during:

3... 2... 1...

If it gets a valid reading, it can use that number.

Slightly evil. Very effective.

Learning player patterns


The more interesting strategy uses TensorFlow.js.

Every batting move is stored:

7, 4, 2, 7, 8, 4, 7...

The model learns from:

  • the player's last 5 moves
  • overall frequency of numbers 1-9
  • recent frequency of numbers 1-9

This produces 63 input features.

The network is intentionally small:

63 inputs
↓
Dense 64
↓
Dense 32
↓
9-way Softmax

The output might look like:

4 -> 18%
7 -> 42%
8 -> 12%
...

So the model predicts 7 as the player's next move.

Training starts after enough moves have been collected and retrains periodically rather than after every ball.

What surprised me


The machine learning was not actually the hardest part.

The trickier problems were:

  • thumb detection across different hand orientations
  • synchronizing countdown and capture timing
  • preventing invalid camera frames from affecting gameplay
  • managing game transitions cleanly
  • keeping browser ML from interfering with real-time video processing

A small game ended up touching computer vision, React state management, probability, feature engineering, browser ML, and real-time interaction design.

What I'd improve next


I'd like to add:

  • a short multi-frame voting window instead of using one camera frame
  • proper ML-vs-random prediction accuracy tracking
  • player profiles
  • a comparison between neural networks and simpler approaches like Markov chains
  • better gesture classification for rotated hands


Tech Stack


React
Vite
MediaPipe Tasks Vision
TensorFlow.js
WebRTC / getUserMedia
localStorage

It started as a simple question:

Can I play hand cricket against my webcam?

It turned into:

Can the computer learn how predictable I am?#gamedev #javascript #machinelearning #react #software #coding #development #engineering #inclusive #community
I Built an Adaptive Hand Cricket Game Using React, MediaPipe, and TensorFlow.js

Show Original PostReport

A weather app is often seen as a simple tutorial project, but turning it into a resilient, production-ready system requires solving real-world frontend challenges.

...

🚀 Beyond a Basic Weather App: Architecture & Resilience in React


A weather app is often seen as a simple tutorial project, but turning it into a resilient, production-ready system requires solving real-world frontend challenges.

Here is how I architected my Weather Application with a focus on system reliability:

⚡ The Architecture Highlights:

  • Type-Safe Data Flow: Strongly typed API payloads (TypeScript) to prevent runtime crashes on inconsistent location responses.
  • Resilient State Machine: Clean separation of UI states (loading, stale, error boundary, and cache) using TanStack Query.
  • Debounced Geocoding: Custom search hooks with debouncing and in-memory caching to minimize unnecessary network requests.
  • Decoupled Service Layer: Isolated API logic into a dedicated layer to keep UI components purely presentational and easily testable.

📊 The Result:
Zero unhandled runtime crashes, optimized network consumption, and a modular architecture ready for expansion.

🔗 Live Demo: [Insert Your Link]

💻 GitHub Repo: [Insert Your Repo Link]

ReactJS #TypeScript #FrontendArchitecture #CleanCode #WebDevelopment #SoftwareEngineering

#react #typescript #webdev #architecture #software #coding #development #engineering #inclusive #community
Beyond a Basic Weather App: Architecture & Resilience in React

Show Original PostReport

🌗 新粗獷主義組件庫:立即開始打造新粗獷主義排版
➤ 融合 shadcn/ui 生態,以 Tailwind v4 驅動的高飽和視覺開發方案
✤ neobrutalism.dev/
本文介紹一套專為 React 與 Tailwind CSS v4 打造的新粗獷主義(Neobrutalism)組件庫,收錄 64 種涵蓋組件、圖表與特殊星形幾何圖形的工具。該系統建立在 shadcn/ui 和 Base UI 的基礎之上,開發者只需選定調色盤,即可快速交付具備大膽視覺風格與現代化排版的網頁應用。
+ 這種新粗獷主義風格在現代網頁設計中非常有辨識度,尤其是結合了 Tailwind v4,讓開發者能更輕鬆地實現厚重邊框與高對比色的美學。
+ 能基於 shadcn/ui 進行擴展真的很棒,既保留了組件的靈活性,又賦予了獨特的視覺靈魂,對於想做個人品牌網站的人來說非常實用。

Show Original PostReport

Hello, DEV Community! 👋

This is my first post here, so I thought I'd start by introducing myself.

I'm currently learning Web Development and exploring technologies like JavaScript, React, and Node.js. I'm also working on improving my problem-solving and building projects that solve real-world problems.

I'm joining this community to:

🚀 Learn from experienced developers
💻 Build and share projects
🧠 Understand how things actually work behind the code
🤝 Connect with other developers
📚 Share what I learn along the way

I know there's a lot to learn, and I'm definitely going to make mistakes along the way. But that's part of the journey.

So, here's to learning, building, breaking things, and building them again. 🚀

Looking forward to learning from everyone here!

What's one piece of advice you'd give to someone starting their developer journey? 👇

WebDevelopment #JavaScript #React #LearningInPublic #DevCommunity

#beginners #javascript #learning #webdev #software #coding #development #engineering #inclusive #community
My First Step Into the Developer Community

Show Original PostReport

田中義弘 | taziku CEO / AI × Creative (@taziku_co)

`/page-mascot` 에이전트 스킬은 지정한 캐릭터를 커서를 따라다니고 클릭에 반응하는 웹 마스코트로 생성한다. 결과물을 React 컴포넌트로 사이트에 통합할 수 있어, 에이전트 기반 UI 생성 및 인터랙티브 웹 경험 구현 사례로 활용 가능하다.

x.com/taziku_co/status/2099493

#aiagent #react #webdevelopment #ui #agentskills

Show Original PostReport

Как разделить фронтенд на модули и связать их между собой: на примере маркетплейса

Как организовать бизнес-логику приложения, связать её через DI и отделить от платформы. Как организовать архитектуру React-приложения? На примере маркетплейса разберём границы feature-модулей, взаимодействие сервисов через DI, разделение серверного и клиентского состояния и работу с браузерными API. Покажем, как проверять архитектурные правила с помощью ESLint и тестов, сохраняя код простым и понятным для разработчиков и LLM. К статье прилагается работающий демо-репозиторий.

habr.com/ru/companies/rwb/arti

#фронтенд_архитектура #di #react #typescript

Show Original PostReport