primer commit

This commit is contained in:
Soka_jplr 2024-02-28 07:55:43 -06:00
commit 57e30a5de9
19 changed files with 2700 additions and 0 deletions

73
Paint-ASCII/build.xml Normal file
View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Paint-ASCII" default="default" basedir=".">
<description>Builds, tests, and runs the project Paint-ASCII.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Paint-ASCII-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
Paint-ASCII/manifest.mf Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=9afbea3b
build.xml.script.CRC32=6bb4f591
build.xml.stylesheet.CRC32=f85dc8f2@1.108.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=9afbea3b
nbproject/build-impl.xml.script.CRC32=fcde2571
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.108.0.48

View File

@ -0,0 +1,6 @@
compile.on.save=true
<<<<<<< HEAD
user.properties.file=C:\\Users\\juanl\\AppData\\Roaming\\NetBeans\\19\\build.properties
=======
user.properties.file=C:\\Users\\juanl\\AppData\\Roaming\\NetBeans\\19\\build.properties
>>>>>>> 947a1e7da3733ddaf1e7a54eb212524e15f57ca0

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/juanl/Documents/NetBeansProjects/Paint-ASCII/src/Paquete/LienzoAutomatico.java</file>
<file>file:/C:/Users/juanl/Documents/NetBeansProjects/Paint-ASCII/src/Paquete/Main.java</file>
<file>file:/C:/Users/juanl/Documents/NetBeansProjects/Paint-ASCII/src/Paquete/Lienzo.java</file>
<file>file:/C:/Users/juanl/Documents/NetBeansProjects/Paint-ASCII/src/Paquete/LienzoManuel.java</file>
</group>
</open-files>
</project-private>

View File

@ -0,0 +1,95 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Paint-ASCII.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/Paint-ASCII
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=\ --enable-preview
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=20
javac.target=20
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=Paint-ASCII
main.class=Paquete.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=\ --enable-preview
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Paint-ASCII</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@ -0,0 +1,42 @@
package Paquete;
public abstract class Lienzo {
protected int largo;
protected int ancho;
protected String nombre;
public Lienzo(int largo, int ancho) {
this.largo = largo;
this.ancho = ancho;
}
public int getLargo() {
return largo;
}
public int getAncho() {
return ancho;
}
public void setLargo(int largo) {
this.largo = largo;
}
public void setAncho(int ancho) {
this.ancho = ancho;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public abstract void crearLienzo();
public abstract boolean pintar();
public abstract void LimpiarConsola();
public abstract void mostrarLienzo();
public abstract boolean exportar();
public abstract boolean eliminarC();
}

View File

@ -0,0 +1,404 @@
package Paquete;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.Random;
/**
*
* @author reyes
*/
public class LienzoAutomatico extends Lienzo {
private String lienzo;
public LienzoAutomatico(int largo, int ancho) {
super(largo, ancho);
}
@Override
public void crearLienzo() {
String[] lienzoarrray = new String[20];
lienzoarrray[0]
= " _____ \n"
+ " / ___ \\\n"
+ " / / _ \\ \\\n"
+ " /( /( /(_)\\ )\\ )\\\n"
+ " ( \\ \\ ___ / / )\n"
+ " ( \\ _____ / )\n"
+ " /( )\\\n"
+ "| \\ / |\n"
+ "| \\ _______ / |\n"
+ " \\ / \\ / \\ /\n"
+ " \\/ | | \\/\n"
+ " | | \n"
+ " | |\n"
+ " | |";
lienzoarrray[1] = ""
+ ",;;;;;;;;;;;.\n"
+ " ,;;;;;;;;;`````)\n"
+ ",;;;;;;;;' (@) ,',\n"
+ ";;;;;;;;') \\ ,\n"
+ ";;;;;;;;_} _) ',\n"
+ ";;;;;;' _;_______________\n"
+ "`;;;;; ;_.---------------'\n"
+ " `;;; (\n"
+ " `;. )";
lienzoarrray[2] = " |_|_|\n"
+ " \\_|||;;_/\n"
+ " \\d||%||%:b/ |_|_|\n"
+ " \\d~|dO%|i::b/ \\_|||;;_/\n"
+ " ._H||dSf|||%::H_. \\d|||||;:b/\n"
+ " ._H@|dLF|}|;::H_. \\d||#H#|;::b/\n"
+ " ._H||dXFt||;.:H_. ._H||#H#|||;::H_. \n"
+ " ._?|{|P|||/;:.P_. ._H||#H#|||;::H_.\n"
+ " ._Hy||t|||;:H_. ._H||#H#|||;::H_.\n"
+ " ._?|x||T|;i:P_. ._?|||#||||;::P_.\n"
+ " ._H||i||;:H_. ._H|||||||;:H_.\n"
+ " ._H|\"|||;:H_. ._?||||||;::P_.\n"
+ " .=================. ._H|||||;:H_.\n"
+ " |;;|#H#|;;;;;;;;: | ._H|||||;:H_.\n"
+ " .=================. .=================.\n"
+ " |;|#H#|;;;;;;;: | |_________________|\n"
+ " |;|#H#|;;;;;: | | |\n"
+ " |;|#H#|;;;;;: | | |\n"
+ " |;|#H#|;;;: | | |\n"
+ " |;|#H#|;;;: | | |\n"
+ " |;|#H#|;: | | |\n"
+ " ========= |_________|";
lienzoarrray[3] = " ,-._\n"
+ " _.-' '--.\n"
+ " .' _ -`\\_\n"
+ " / .----.`_.'----'\n"
+ " ;/ `\n"
+ " /_;\n"
+ "\n"
+ " ._ ._ ._ ._\n"
+ "_.-._)`\\_.-._)`\\_.-._)`\\_.-._)`\\_.-._";
lienzoarrray[4] = " _._ _,-'\"\"`-._\n"
+ "(,-.`._,'( |\\`-/|\n"
+ " `-.-' \\ )-`( , o o)\n"
+ " `- \\`_`\"'-";
lienzoarrray[5] = "(\"`-''-/\").___..--''\"`-._ \n"
+ " `6_ 6 ) `-. ( ).`-.__.`) \n"
+ " (_Y_.)' ._ ) `._ `. ``-..-' \n"
+ " _..`--'_..-_/ /--'_.'\n"
+ " ((((.-'' ((((.' (((.-' ";
lienzoarrray[6] = " _________ . .\n"
+ "(.. \\_ , |\\ /|\n"
+ " \\ O \\ /| \\ \\/ /\n"
+ " \\______ \\/ | \\ / \n"
+ " vvvv\\ \\ | / |\n"
+ " \\^^^^ == \\_/ |\n"
+ " `\\_ === \\. |\n"
+ " / /\\_ \\ / |\n"
+ " |/ \\_ \\| /\n"
+ " snd \\________/";
lienzoarrray[7] = " sjw ..----.._ _\n"
+ " .' .--. \"-.(O)_\n"
+ "'-.__.-'\"'=:| , _)_ \\__ . c\\'-..\n"
+ " ''------'---''---'-\"";
lienzoarrray[8] = "######################################################################################\n"
+ "# # \n"
+ "# ,.--------._ #\n"
+ "# / ''. #\n"
+ "# ,' \\ |\"\\ /\\ /\\ #\n"
+ "# /\"| / \\ |__\" ( \\\\ // ) #\n"
+ "# \"_\"| / z#####z \\ // \\ \\\\ // / #\n"
+ "# \\\\ ##### ##------\". \\// \\_\\\\||||//_/ #\n"
+ "# \\\\/-----\\ / \". \\ \\/ _ _ \\ #\n"
+ "# \\| \\ | ,,--.. \\ \\/|(O)(O)| #\n"
+ "# | ,.--._ \\ ( | ## \\) \\ \\/ | | #\n"
+ "# |( ## )/ \\ `-....-// |///////////////_\\/ \\ / #\n"
+ "# '--'.\" \\ \\ // |____| #\n"
+ "# /' / ) --. \\ || / \\ #\n"
+ "# ,..| \\.________/ `-.. \\ \\ \\| \\ 0 0 / #\n"
+ "# _,##/ | ,/ / \\ \\ \\ \\ U / \\_//_/ #\n"
+ "# :###.- | ,/ / \\ /' \"\"\\ .\\ ( / #\n"
+ "# /####| | (.___________,---',/ | |\\=._____| |_/ #\n"
+ "# /#####| | \\__|__|__|__|_,/ |####\\ | || #\n"
+ "# /######\\ \\ \\__________/ /#####| \\ || #\n"
+ "# /|#######`. `\\ /#######\\ | || #\n"
+ "# /++\\#########\\ \\ _,' _/#########\\ | || #\n"
+ "# /++++|#########| \\ .---.. ,/ ,'##########.\\|_|| Donkey By #\n"
+ "# //++++|#########\\. \\. ,-/ ,'########,+++++\\\\_\\\\ Hard'96 #\n"
+ "# /++++++|##########\\. '._ _,/ ,'######,''++++++++\\ #\n"
+ "# |+++++++|###########| -----.\" _'#######' +++++++++++\\ #\n"
+ "# |+++++++|############\\. \\\\ // /#######/++++ S@yaN +++\\ #\n"
+ "# ________________________\\\\___//______________________________________ #\n"
+ "# / ____________________________________________________________________) #\n"
+ "# / / _ _ #\n"
+ "# | | | | | | #\n"
+ "# \\ \\ | | _ ____ ____ | | _ #\n"
+ "# \\ \\ | || \\ / ___) / _ ) | | / ) #\n"
+ "# _____) ) | | | | | | ( __ / | |< ( #\n"
+ "# (______/ |_| |_| |_| \\_____) |_| \\_) #\n"
+ "# 19.08.02 #\n"
+ "######################################################################################";
lienzoarrray[9] = " .-.\n"
+ " |_:_|\n"
+ " /(_Y_)\\\n"
+ ". ( \\/M\\/ )\n"
+ " '. _.'-/'-'\\-'._\n"
+ " ': _/.--'[[[[]'--.\\_\n"
+ " ': /_' : |::\"| : '.\\\n"
+ " ': // ./ |oUU| \\.' :\\\n"
+ " ': _:'..' \\_|___|_/ : :|\n"
+ " ':. .' |_[___]_| :.':\\\n"
+ " [::\\ | : | | : ; : \\\n"
+ " '-' \\/'.| |.' \\ .;.' |\n"
+ " |\\_ \\ '-' : |\n"
+ " | \\ \\ .: : | |\n"
+ " | \\ | '. : \\ |\n"
+ " / \\ :. .; |\n"
+ " / | | :__/ : \\\\\n"
+ " | | | \\: | \\ | ||\n"
+ " / \\ : : |: / |__| /|\n"
+ " snd | : : :_/_| /'._\\ '--|_\\\n"
+ " /___.-/_|-' \\ \\\n"
+ " '-'";
lienzoarrray[10] = "-\"'\"-.\n"
+ " | | \n"
+ " (`-._____.-')\n"
+ " .. `-._____.-' ..\n"
+ " .', :./'.== ==.`\\.: ,`.\n"
+ " : ( : ___ ___ : ) ;\n"
+ " '._.: |0| |0| :._.'\n"
+ " / `-'_`-' \\\n"
+ " _.| / \\ |._\n"
+ " .'.-| ( ) |-.`.\n"
+ " //' | .-\"`\"`-'\"`\"-. | `\\\\ \n"
+ " || | `~\":-...-:\"~` | ||\n"
+ " || \\. `---' ./ ||\n"
+ " || '-._ _.-' ||\n"
+ " / \\ _/ `~:~` \\_ / \\\n"
+ "||||\\) .-' / \\ `-. (/||||\n"
+ "\\||| (`.___.')-(`.___.') |||/\n"
+ " '\"' jgs `-----' `-----' '\"'";
lienzoarrray[11] = ".-\"\". _____ .\"\"-.\n"
+ " //.==.\\ (*****) /.==.\\\\\n"
+ ";//:::'||,;;;;;,||.:::\\\\;\n"
+ "||::::.\\((((/\\)))/.::::||\n"
+ "||:::. )))a a((( .:::||\n"
+ "||:::. ((( ^ ))) ':::||\n"
+ "||::. )))-^-((( .:::||\n"
+ "||::' (((\\\\_//))) .::||\n"
+ "||::. / \\_/ \\ '::||\n"
+ "||:: / \\ ::||\n"
+ "||::/ | | \\::||\n"
+ "||:/ ; ; \\:||\n"
+ "||/ }===o={ \\||\n"
+ "|`-,_ ; ( ; _,-'|\n"
+ "||(_/'._| ) |_.'\\_)||\n"
+ "||::. || ( || .::||\n"
+ "||::. / | ) | \\ '::||\n"
+ "||:' | | | | .:||\n"
+ "||::/ | | \\::||\n"
+ ";|:| | | |:|;\n"
+ " \\/ | | \\/\n"
+ " jgs | |\n"
+ " |:.:.:.:|\n"
+ " :':':':':";
lienzoarrray[12] = " _.--\"\"`-..\n"
+ " ,' `.\n"
+ " ,' __ `.\n"
+ " /| \" __ \\\n"
+ " , | / |. .\n"
+ " |,' !_.'| |\n"
+ " ,' ' | |\n"
+ " / |`--'| |\n"
+ " | `---' |\n"
+ " . , | ,\".\n"
+ " ._ ' _' | , ' \\ `\n"
+ " `.. `.`-...___,...---\"\" | __,. ,`\" L,|\n"
+ " |, `- .`._ _,-,.' . __.-'-. / . , \\\n"
+ "-:.. `. `-..--_.,.< `\" / `. `-/ | .\n"
+ " `, \"\"\"\"' `. ,' | | ',,\n"
+ " `. ' ' / ' |'. |/\n"
+ " `. | \\ _,-' | ''\n"
+ " `._' \\ '\"\\ . |\n"
+ " | ' \\ `._ ,'\n"
+ " | ' \\ .'|\n"
+ " | . \\ | |\n"
+ " | | L ,' |\n"
+ " ` | | / '\n"
+ " \\ | | ,' /\n"
+ " ,' \\ | _.._ ,-..___,..-' ,'\n"
+ " / . . `! ,j'\n"
+ " / `. / . .'/\n"
+ " . `. / | _.'.'\n"
+ " `. 7`'---' |------\"'_.'\n"
+ " _,.`,_ _' ,''-----\"'\n"
+ " _,-_ ' `. .' ,\\\n"
+ " -\" /`. _,' | _ _ _.|\n"
+ " \"\"--'---\"\"\"\"\"' `' '! |! /\n"
+ " `\" \" -' mh";
lienzoarrray[13] = " T\\ T\\\n"
+ " | \\| \\\n"
+ " | | :\n"
+ " _____I__I |\n"
+ " .' '.\n"
+ " .' '\n"
+ " | .. '\n"
+ " | /__. |\n"
+ " :.' -' |\n"
+ " /__. |\n"
+ " /__, \\ |\n"
+ " |__\\ _| |\n"
+ " : '\\ .'| |\n"
+ " |___|_,,,/ | | _..--.\n"
+ " ,--_- | /' \\../ / /\\\\\n"
+ " ,'|_ I---| 7 ,,,_/ / , / _\\\\\n"
+ " ,-- 7 \\| / ___..,,/ / , ,_/ '-----.\n"
+ " / , \\ |/ ,____,,,__,,__/ '\\\n"
+ ", , \\__,,/ |\n"
+ "| '. _..---.._ !.\n"
+ "! | .' z_M__s. '. |\n"
+ ".:' | (-_ _--') : L !\n"
+ ".'. '. Y _.' \\, :\n"
+ " . '-----' ! .\n"
+ " . / \\ . .";
lienzoarrray[14] = " __,__\n"
+ " .--. .-\" \"-. .--.\n"
+ " / .. \\/ .-. .-. \\/ .. \\\n"
+ " | | '| / Y \\ |' | |\n"
+ " | \\ \\ \\ 0 | 0 / / / |\n"
+ " \\ '- ,\\.-\"`` ``\"-./, -' /\n"
+ " `'-' /_ ^ ^ _\\ '-'`\n"
+ " .--'| \\._ _ _./ |'--. \n"
+ " /` \\ \\.-. / / `\\\n"
+ " / '._/ |-' _.' \\\n"
+ " / ; /--~' | \\\n"
+ " / .'\\|.-\\--. \\ \\\n"
+ " / .'-. /.-.;\\ |\\|'~'-.|\\ \\\n"
+ " \\ `-./`|_\\_/ ` `\\'. \\\n"
+ " '. ; ___) '.`; /\n"
+ " '-.,_ ; ___) \\/ /\n"
+ " \\ ``'------'\\ \\ ` /\n"
+ " '. \\ '. | ;/_\n"
+ "jgs ___> '. \\_ _ _/ , '--.\n"
+ " .' '. .-~~~~~-. / |--'`~~-. \\\n"
+ " // / .---'/ .-~~-._/ / / /---..__.' /\n"
+ " ((_(_/ / / (_(_(_(---.__ .'\n"
+ " | | _ `~~`\n"
+ " | | \\'.\n"
+ " \\ '....' |\n"
+ " '.,___.'";
lienzoarrray[15] = " `|. \n"
+ " |:\\-, .| \\.\n"
+ " |: `.------------------------------------.\n"
+ " / / o o o o o o o o o o o o o.-.o o (_`. \n"
+ "/_ \\_ . .= |'| `) \n"
+ " ``\"\"\"\"\"\"\"\"\"\"\"// / \"\"\"\"\" `\"\"\"------\"'";
lienzoarrray[16] = " _.._ _..---.\n" +
" .-\" ;-\" \\\n" +
" / / |\n" +
"| | _= |\n" +
"; _.-'\\__.-') |\n" +
" `-' | | ;\n" +
" | /; / _,\n" +
" .-.;.-=-./-\"\"-.-` _`\n" +
" / | \\ \\-` `,\n" +
" | | | |\n" +
" |____|______| |\n" +
" \\0 / \\0 / /\n" +
" .--.-\"\"-.`--' .'\n" +
" (# ) , \\\n" +
" ('--' /\\` \\\n" +
" \\ ,, .' \\\n" +
" `-._ _.'\\ \\\n" +
"jgs `\"\"` \\ \\";
lienzoarrray[17] = " _..-----._\n"
+ " .' '.\n"
+ " / \\\n"
+ " | ;\n"
+ " | |\n"
+ " \\ |\n"
+ " \\ ;\n"
+ " _..----' /\n"
+ " .`-. .-'``'-. .-'\n"
+ " .'_ ` _ '. `'.\n"
+ " / _` _ ` \\ \\ _...._\n"
+ " _ | / \\ / \\ | | .-' `'.\n"
+ " / \\ | | /| | /| | ;' \\\n"
+ " | |_\\ \\_|/ \\_|/ / ;\n"
+ " .\\_/ `'-. /_...._ |\n"
+ "/ ` `\\ |\n"
+ "| __ | /\n"
+ " \\ / ` //'. .'\n"
+ " '._ .' .' `'-...-'`\n"
+ " `\"'-.,__ ___.-' .-'\n"
+ " jgs `-._```` __..--'`\n"
+ " ``````";
lienzoarrray[18] = " __\n"
+ " .-' |\n"
+ " / <\\|\n"
+ " / \\'\n"
+ " |_.- o-o\n"
+ " / C -._)\\\n"
+ " /', |\n"
+ "| `-,_,__,'\n"
+ "(,,)====[_]=|\n"
+ " '. ____/\n"
+ " | -|-|_\n"
+ " |____)_) [n4biS]";
Random random = new Random();
int numrandom = random.nextInt(18);
lienzo = lienzoarrray[numrandom];
System.out.println("Tamañno del liezoarray es: ´" + lienzoarrray[numrandom].length());
System.out.println("Tamaño del lienzo es: " + lienzo.length());
System.out.println(lienzo);
}
@Override
public boolean pintar() {
return false;
}
@Override
public void LimpiarConsola() {
}
@Override
public void mostrarLienzo() {
crearLienzo();
}
@Override
public boolean exportar() {
File archivo = null;
FileWriter fw = null;
BufferedWriter bw = null;
try{
archivo = new File("./"+nombre+".txt");
fw = new FileWriter(archivo);
bw = new BufferedWriter(fw);
for(int i = 1; i<100; i++){
bw.write(lienzo);
bw.write("\n");
}
bw.flush();
fw.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
return false;
}
@Override
public boolean eliminarC() {
return false;
}
}

View File

@ -0,0 +1,126 @@
package Paquete;
import java.io.*;
public class LienzoManuel extends Lienzo{
private char [][] matriz;
public LienzoManuel(int largo, int ancho) {
super(largo, ancho);
this.matriz = new char [this.largo][this.ancho];
}
public char[][] getMatriz() {
return matriz;
}
public void setMatriz(char[][] matriz) {
this.matriz = matriz;
}
@Override
public void crearLienzo() {
for(int i = 1; i<ancho; i++){
for(int j=1; j<largo; j++){
matriz[j][i]= ' ';
if(j==1 || j==largo-1){
matriz[j][i]= '│';
}
if(i==1 || i==ancho-1){
matriz[j][i]= '-';
}
}
}
for(int i = 1; i<ancho; i++){
String letra = ""+i;
matriz[0][i]= letra.charAt(0);
}
for(int j = 1; j<largo; j++){
String letra = ""+j;
matriz[j][0]= letra.charAt(0);
}
matriz[0][0] = ' ';
matriz[1][1] = '┌';
matriz[1][ancho-1] = '└';
matriz[largo-1][1] = '┐';
matriz [largo-1][ancho-1] = '┘';
}
public boolean pintar(int fila, int columna, char c) {
boolean respuesta = false;
if(columna<=0 || columna>=largo || fila<=0 || fila>=ancho){
respuesta = false;
}else{
matriz[columna][fila] = c;
respuesta = true;
}
return respuesta;
}
@Override
public void LimpiarConsola() {
for (int i = 0; i < 50; i++) {
System.out.println();
}
}
@Override
public void mostrarLienzo() {
for(int i = 0; i<ancho; i++){
for(int j=0; j<largo; j++){
System.out.print(matriz[j][i]);
}
System.out.println("");
}
}
@Override
public boolean exportar() {
File archivo = null;
FileWriter fw = null;
BufferedWriter bw = null;
try{
archivo = new File("./"+nombre+".txt");
fw = new FileWriter(archivo);
bw = new BufferedWriter(fw);
for(int i = 1; i<ancho; i++){
for(int j=1; j<largo; j++){
bw.write(matriz[j][i]);
}
bw.write("\n");
}
bw.flush();
fw.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
return true;
}
public boolean eliminarC(int fila, int columna) {
boolean respuesta = false;
if(columna<=0 || columna>=largo || fila<=0 || fila>=ancho){
respuesta = false;
}else{
matriz[columna][fila] = ' ';
respuesta = true;
}
return respuesta;
}
@Override
public boolean pintar() {
return false;
}
@Override
public boolean eliminarC() {
return false;
}
public boolean eliminarTL(){
crearLienzo();
return true;
}
}

View File

@ -0,0 +1,145 @@
package Paquete;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int largo;
int ancho;
int x;
int y;
int opcion;
int menu;
char caracter;
boolean bandera = true;
boolean bandera2 = true;
boolean bandera3 = true;
Scanner lectura = new Scanner(System.in);
while (bandera) {
System.out.println("Bienvenido para empezar con el programa. Elige una Opción");
System.out.println("1)Pintar ASCII");
System.out.println("2)ASCII-Random");
System.out.println("3)Salir");
menu = obtenerEntero(lectura);
switch (menu) {
case 1:
System.out.println("Ingrese el ancho del lienzo: ");
ancho = obtenerEntero(lectura);
System.out.println("Ingrese el largo del lienzo: ");
largo = obtenerEntero(lectura);
if (ancho > 0 && largo > 0) {
LienzoManuel l = new LienzoManuel(largo + 1, ancho + 1);
String nombrel;
l.crearLienzo();
l.mostrarLienzo();
while (bandera2) {
System.out.println("Escoge una opcion");
System.out.println("1)Pintar un caracter");
System.out.println("2)Borrar un Caracter");
System.out.println("3)Exportar lienzo");
System.out.println("4)Borrar todo el Lienzo");
System.out.println("5)Salir al menu Principal");
opcion = obtenerEntero(lectura);
switch (opcion) {
case 1:
System.out.println("Da la cordenada en X:");
x = obtenerEntero(lectura);
System.out.println("Da la cordenada en Y:");
y = obtenerEntero(lectura);
System.out.println("Da el caracter:");
caracter = lectura.next().charAt(0);
l.pintar(y, x, caracter);
l.LimpiarConsola();
break;
case 2:
System.out.println("Da la cordenada en X:");
x = obtenerEntero(lectura);
System.out.println("Da la cordenada en Y:");
y = obtenerEntero(lectura);
l.eliminarC(y, x);
System.out.println("Caracter eliminado");
break;
case 3:
lectura.nextLine();
System.out.println("Ponle un nombre al lienzo");
nombrel = lectura.nextLine();
l.setNombre(nombrel);
if (l.exportar()) {
System.out.println("Exportado correctamente");
}
break;
case 4:
l.crearLienzo();
break;
case 5:
System.out.println("Regresando al menu principal");
bandera2 = false;
break;
default:
System.out.println("ERROR. Opcion incorrecta");
}
l.mostrarLienzo();
}
} else {
System.out.println("ERROR. Solo acepta numeros positivos :(");
System.out.println();
}
break;
case 2:
while (bandera3) {
System.out.println("Escoge una opcion");
System.out.println("1)Mostrar");
System.out.println("2)Exportar");
System.out.println("3)Salir");
opcion = obtenerEntero(lectura);
LienzoAutomatico la = new LienzoAutomatico(100, 100);
switch (opcion) {
case 1:
la.mostrarLienzo();
break;
case 2:
String nombrea;
lectura.nextLine();
System.out.println("Ponle un nombre al lienzo");
nombrea = lectura.nextLine();
la.setNombre(nombrea);
if (la.exportar()) {
System.out.println("Exportado correctamente");
}
break;
case 3:
System.out.println("Regresando al menu principal");
bandera3 = false;
break;
default:
System.out.println("ERROR. Opcion incorrecta");
}
}
break;
case 3:
System.out.println("Hasta Luego");
bandera = false;
break;
default:
System.out.println("ERROR. Opcion incorrecta");
}
}
}
public static int obtenerEntero(Scanner lectura) {
while (true) {
try {
return lectura.nextInt();
} catch (InputMismatchException e) {
System.out.println("ERROR. Debes ingresar un número entero.");
System.out.println("Por favor, intenta nuevamente:");
lectura.next(); // Limpiar el búfer de entrada
}
}
}
}