I am new in both programming and this page, I am designing a scrabble
with my basic knowledge and few, the roll is that I do not know how to check if the word that I have written on the keyboard contains the letters provided by the program by a random
assigned to the index of a array
with the alphabet. for now I have this: D regards!
import java.util.Scanner;
public class Scrabble {
static String palabra;
static char[] letras = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'ñ', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', };
static char[] opciones = new char[7];
static int puntos = 0;
static int puntoLetra;
static int puntoL[] = new int [7];
public static void Random() {
System.out.println("Tus letras son: ");
for (int i = 0; i < 7; i++) {
puntoLetra = (int) Math.round(Math.random() * 2) + 1;
int rand = (int) Math.round(Math.random() * 26);
System.out.println(letras[rand] + " = " + puntoLetra + " puntos.");
opciones[i] = letras[rand];
puntoL[i] = puntoLetra;
}
System.out.println();
}
public static void Pedir() {
Scanner sc = new Scanner(System.in);
System.out.println("Si has conseguido formar una palabra, introducela, de lo contrario teclea \"siguiente\" para pasar de ronda.");
palabra = sc.nextLine();
if(palabra.contains("siguiente")) {
System.out.println("No has conseguido formar una palabra y no has ganado ningun punto \nTu puntuación actual es de " + puntos + " puntos.\n\nSiguiente ronda.\n");
Random();
Pedir();
}else{
for(int i = 0; i < palabra.length(); i++) {
}
}
}
public static void main(String[] args) {
Random();
Pedir();
}
}