-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
80 changed files
with
161,474 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fonts; | ||
|
||
import java.awt.Font; | ||
import java.io.InputStream; | ||
|
||
public class Fuentes { | ||
private Font font = null; | ||
public String BIT8 = "8-BIT WONDER.TTF"; | ||
public String PC = "PixCon.ttf"; | ||
public String PLL = "Pixellari.ttf"; | ||
|
||
/* Font.PLAIN = 0 , Font.BOLD = 1 , Font.ITALIC = 2 | ||
* tamaño = float | ||
*/ | ||
public Font fuente( String fontName, int estilo, float tamanio) | ||
{ | ||
try { | ||
//Se carga la fuente | ||
InputStream is = getClass().getResourceAsStream(fontName); | ||
font = Font.createFont(Font.TRUETYPE_FONT, is); | ||
} catch (Exception ex) { | ||
//Si existe un error se carga fuente por defecto ARIAL | ||
System.err.println(fontName + " No se cargo la fuente"); | ||
font = new Font("Arial", Font.PLAIN, 14); | ||
} | ||
Font tfont = font.deriveFont(estilo, tamanio); | ||
return tfont; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main; | ||
|
||
import vistas.Base; | ||
|
||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
// TODO Auto-generated method stub | ||
Base frame = new Base(); | ||
frame.setVisible(true); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package modelo; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Random; | ||
|
||
public record Palabra(String palabra, Integer longitud, List<String> letras) { | ||
|
||
public static Palabra of(String palabra) { | ||
Integer longitud = palabra.length(); | ||
List<String> ls = new ArrayList<String>(); | ||
String[] letras = palabra.split(""); | ||
for(int i = 0; i < letras.length; i++) { | ||
ls.add(letras[i].toUpperCase()); | ||
} | ||
return new Palabra(palabra.toUpperCase(), longitud, ls); | ||
} | ||
|
||
// Parseo de las Palabras de txt a lista | ||
@SuppressWarnings("finally") | ||
public static ArrayList<Palabra> obtener() { | ||
final String NOMBRE_ARCHIVO = "src/resources/palabras.txt"; | ||
ArrayList<Palabra> palabras = new ArrayList<>(); | ||
FileReader fileReader = null; | ||
BufferedReader bufferedReader = null; | ||
try { | ||
fileReader = new FileReader(NOMBRE_ARCHIVO); | ||
bufferedReader = new BufferedReader(fileReader); | ||
String linea; | ||
while ((linea = bufferedReader.readLine()) != null) { | ||
if(linea.length() < 12) { | ||
palabras.add(Palabra.of(linea)); | ||
} | ||
} | ||
} catch (IOException e) { | ||
System.out.println("Excepción leyendo archivo: " + e.getMessage()); | ||
} finally { | ||
try { | ||
if (fileReader != null) { | ||
fileReader.close(); | ||
} | ||
if (bufferedReader != null) { | ||
bufferedReader.close(); | ||
} | ||
} catch (IOException e) { | ||
System.out.println("Excepción cerrando: " + e.getMessage()); | ||
} | ||
return palabras; | ||
} | ||
} | ||
|
||
//Seleccion de Palabra Aleatoria | ||
public static Palabra palabraAleatoria(List<Palabra> ls) { | ||
Random rand = new Random(); | ||
return ls.get(rand.nextInt(ls.size())); | ||
} | ||
|
||
//Crea una lista de guiones con el mismo tamaño que el tamaño de la palabra | ||
public List<String> listaGuiones() { | ||
List<String> ls = new ArrayList<String>(); | ||
for(int i = 0; i < this.longitud;i++) { | ||
ls.add("_"); | ||
} | ||
return ls; | ||
} | ||
|
||
//Combierte una lista en cadena | ||
public static String concatena(List<String> ls) { | ||
String guiones = " "; | ||
for(String letra: ls) { | ||
guiones += letra + " "; | ||
} | ||
return guiones; | ||
} | ||
|
||
/* | ||
* MODIFICA LA PALABRA DADA LA LETRA SUSTITUYE LOS GUIONES POR LA/S LETRAS Y VICEBERSA | ||
*/ | ||
public Map<List<String>, List<String>> modificaPalabra(String letra, List<String> listaGuiones, List<String> listaPalabra) { | ||
int ind = 0; | ||
letra = letra.toUpperCase(); | ||
Map<List<String>,List<String>> mp = new HashMap<>(); | ||
while(listaPalabra.contains(letra)) { | ||
ind = listaPalabra.indexOf(letra); | ||
|
||
listaPalabra.remove(ind); | ||
listaPalabra.add(ind, "_"); | ||
|
||
listaGuiones.remove(ind); | ||
listaGuiones.add(ind, letra); | ||
} | ||
mp.put(listaPalabra, listaGuiones); | ||
return mp; | ||
|
||
} | ||
|
||
|
||
public static void main(String[] args) { | ||
List<Palabra> ls = Palabra.obtener(); | ||
Palabra p = Palabra.palabraAleatoria(ls); | ||
System.out.println(p); | ||
List<String> listaPalabra = new ArrayList<String>(); | ||
listaPalabra.addAll(p.letras()); | ||
List<String> listaGuiones = p.listaGuiones(); | ||
System.out.println(listaGuiones); | ||
System.out.println(p.modificaPalabra("a", listaGuiones, listaPalabra)); | ||
System.out.println(ls); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package modelo; | ||
|
||
public enum Personaje { | ||
LUCKYLUKE, LUCKYBLACK | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package modelo; | ||
|
||
public class RutaPersonaje { | ||
|
||
public static String personaje(Personaje personaje) { | ||
if (personaje == Personaje.LUCKYLUKE) return "Lucky Luke,lucky"; | ||
if (personaje == Personaje.LUCKYBLACK) return "Lucky Reverse,black"; | ||
else return ""; | ||
} | ||
|
||
public static String ruta(Personaje personaje) { | ||
return "/img/"+personaje(personaje).split(",")[1]+"/"; | ||
|
||
} | ||
|
||
public static String nombre(Personaje personaje ) { | ||
return personaje(personaje).split(",")[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package modelo; | ||
|
||
import java.awt.Graphics; | ||
import java.awt.Graphics2D; | ||
import java.net.URL; | ||
|
||
import javax.swing.ImageIcon; | ||
import javax.swing.JLabel; | ||
|
||
public class imagen extends JLabel{ | ||
private static final long serialVersionUID = 1L; | ||
private String ruta = ""; | ||
|
||
@Override | ||
protected void paintComponent(Graphics gg) { | ||
Graphics2D g = (Graphics2D)gg; | ||
URL rutaAbsoluta = getClass().getResource(ruta); | ||
|
||
if(rutaAbsoluta != null) { | ||
ImageIcon imagen = new ImageIcon(rutaAbsoluta); | ||
g.drawImage(imagen.getImage(),0,0,this.getWidth(),this.getHeight(), null); | ||
} | ||
|
||
g.dispose(); | ||
} | ||
|
||
|
||
public String getRuta() { | ||
return ruta; | ||
} | ||
|
||
public void setRuta(String ruta) { | ||
this.ruta = ruta; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* | ||
*/ | ||
module Ahorcado { | ||
requires java.desktop; | ||
} |
Oops, something went wrong.