Skip to content

Instantly share code, notes, and snippets.

View bwnyasse's full-sized avatar
🎯
Focusing

Boris-Wilfried bwnyasse

🎯
Focusing
View GitHub Profile
@bwnyasse
bwnyasse / 23-board-ai-smart-scrabble-gemini-5.dart
Created February 18, 2025 04:16
Building a Scrabble Companion with Gemini 2.0: Move Explanation Prompts
String createMoveExplanationPrompt(String playerName, Move move, int currentScore) {
return '''
You are an enthusiastic Scrabble commentator.
Explain this move by $playerName:
- Word: ${move.word}
- Score for this move: ${move.score} points
- Tiles placed: ${move.tiles.map((t) => '${t.letter}(${t.points})').join(', ')}
- Current total after this move: $currentScore
@bwnyasse
bwnyasse / 23-board-ai-smart-scrabble-gemini-4.dart
Created February 18, 2025 04:10
Building a Scrabble Companion with Gemini 2.0: Board State Analysis Prompt
String _constructImageComparisonPrompt(Map<String, dynamic> previousState) {
return '''
Compare these two Scrabble board images: the first is the previous state, the second is after a move.
Identify ONLY new letters that appear in the second image.
Previous board state for reference:
${jsonEncode(previousState)}
Return ONLY a JSON object in exactly this format:
{
@bwnyasse
bwnyasse / 23-board-ai-smart-scrabble-gemini-3.dart
Created February 18, 2025 04:08
Building a Scrabble Companion with Gemini 2.0: Real-time Game State Management
class GameStateProvider with ChangeNotifier {
// Real-time board state sync
Stream<BoardState> getBoardState() {
return FirebaseService().getBoardState(sessionId);
}
// Move processing
Future<void> processMove(Move move) {
// AI analysis & validation
// Score calculation
@bwnyasse
bwnyasse / 23-board-ai-smart-scrabble-gemini-2.dart
Created February 18, 2025 04:05
Building a Scrabble Companion with Gemini 2.0 : Move Explanations and Voice Synthesis
class AIService {
final LLMService _llmService;
bool _isTtsInitialized = false;
Future<String> generateMoveExplanation(
String playerName,
Move move,
int currentScore,
) async {
final prompt = '''
@bwnyasse
bwnyasse / 23-board-ai-smart-scrabble-gemini-1.dart
Created February 18, 2025 04:03
Building a Scrabble Companion with Gemini 2.0 - Move Analysis with Multiple LLMs
class GeminiService {
late GenerativeModel _model;
final ImageStorageService _imageStorage = ImageStorageService();
final FirebaseService _firebaseService = FirebaseService();
GeminiService() {
// Initialize with Gemini 2.0 Flash
_model = FirebaseVertexAI.instance
.generativeModel(model: 'gemini-2.0-flash');
}
/*
* Dart & Flutter - Training
* Workshop: Advanced Dart Programming - HTTP Requests, Streams, and Mixins
* Copyright (Boris-Wilfried Nyasse)
* All rights reserved
*
* Workshop Goals and Objectives:
* - Implement HTTP requests to fetch data from an external API.
* - Use mixins for data formatting.
* - Understand and utilize streams for asynchronous data processing.
/*
* Dart & Flutter - Training
* Workshop: Advanced Dart Programming - HTTP Requests, Streams, and Mixins
* Copyright (Boris-Wilfried Nyasse)
* All rights reserved
*
* Workshop Goals and Objectives:
* - Implement HTTP requests to fetch data from an external API.
* - Use mixins for data formatting.
* - Understand and utilize streams for asynchronous data processing.
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@bwnyasse
bwnyasse / sliding_window.dart
Last active June 2, 2023 13:40
Code Patterns Flutter / Dart
import 'package:flutter/material.dart';
import 'dart:math';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
/*
* Dart & Flutter - Training
*
* Copyright (c) Boris-Wilfried Nyasse
* All rights reserved
*
*/
// Define a class 'Adder' that behaves like a function.
class Adder {