Skip to content

Commit 4864e95

Browse files
committed
ASCII Art
1 parent 73b34b2 commit 4864e95

File tree

6 files changed

+192
-11
lines changed

6 files changed

+192
-11
lines changed

src/SUMMARY.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ Terminal ANKI (might require threads)
5858
5959
Simple REST API
6060
HTML
61+
62+
- [Tic-Tac-Toe]()
63+
- [Chicken Nugget Numbers]()
64+
65+
* Argument Objects (InputArgs)
66+
* Cursor Objects (sql)
67+
* Exception Hierarchies
68+
* Interior Iteration
69+
* Annotations
70+
71+
Make your own iterator
72+
6173
-->
6274

6375
# Modern Java
@@ -179,6 +191,15 @@ HTML
179191
- [Iterate over a String](./loops/iterate_over_a_string.md)
180192
- [Challenges](./loops/challenges.md)
181193

194+
# Interactive Programs II
195+
196+
- [Standard Input II](./standard_input_ii.md)
197+
- [Prompting](./standard_input_ii/prompting.md)
198+
- [Interpreting Input](./standard_input_ii/interpreting_input.md)
199+
- [Reprompting](./standard_input_ii/reprompting.md)
200+
- [Leniency](./standard_input_ii/leniency.md)
201+
- [Delayed Assignment](./standard_input_ii/delayed_assignment.md)
202+
182203
# Projects
183204

184205
<!-- Software is an Interdisciplinary Field -->
@@ -227,7 +248,7 @@ HTML
227248

228249
# Projects
229250

230-
- [Can you Build a Snowman?]()
251+
- [ASCII Art Generator](./projects/ascii_art.md)
231252

232253
# Code Structure
233254

@@ -260,8 +281,8 @@ HTML
260281

261282
# Projects
262283

263-
- [Tic-Tac-Toe]()
264-
- [Chicken Nugget Numbers]()
284+
<!-- chicken nugget number type things come up when dispensing change -->
285+
- [Point of Sale System](./projects/point_of_sale_system.md)
265286

266287
# Data Types III
267288

@@ -319,6 +340,11 @@ HTML
319340
- [Clarity](./instance_methods/clarity.md)
320341
- [Challenges](./instance_methods/challenges.md)
321342

343+
# Interactive Programs III
344+
345+
- [Standard Input III](./standard_input_iii.md)
346+
- [Transporting Data](./standard_input_iii/transporting_data.md)
347+
322348
# Projects II
323349

324350
- [Monte Carlo Sampling]()
@@ -388,15 +414,7 @@ HTML
388414
- [Audience](./code_is_read_more_than_written/audience.md)
389415
- [Practice](./code_is_read_more_than_written/practice.md)
390416

391-
# Interactive Programs
392417

393-
- [Standard Input II](./standard_input_ii.md)
394-
- [Prompting](./standard_input_ii/prompting.md)
395-
- [Interpreting Input](./standard_input_ii/interpreting_input.md)
396-
- [Reprompting](./standard_input_ii/reprompting.md)
397-
- [Leniency](./standard_input_ii/leniency.md)
398-
- [Delayed Assignment](./standard_input_ii/delayed_assignment.md)
399-
- [Transporting Data](./standard_input_ii/transporting_data.md)
400418

401419
# The Computing Environment
402420

src/projects/ascii_art.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# ASCII Art Generator
2+
3+
## Problem Statement
4+
5+
Humans like to draw stuff and to look at drawings of stuff.
6+
7+
We know this is in some manner intrinisic to us as a species
8+
because we've found drawings in caves [dating back at least 51,200 years.](https://en.wikipedia.org/wiki/Cave_painting)
9+
10+
As such it is a normal impulse to use pictures, drawings, iconography, and other forms
11+
of art as a tool for communication.
12+
13+
In the early days of the internet the amount of data you could send between computers was extremely limited.
14+
This meant that, in practice, most people would communicate using solely text.
15+
16+
Instead of making it so that people couldn't send images to eachother, that restriction birthed a
17+
new form of art. Using only the characters available to send as text, people would make and send pictures.
18+
19+
For example, here is a bat from [a website that archives examples of this form of art](https://www.asciiart.eu/animals/bats).
20+
21+
```
22+
/'. .'\
23+
\( \__/ )/
24+
___ / (.)(.) \ ___
25+
_.-"`_ `-.| ____ |.-` _`"-._
26+
.-'.-'//||`'-.\ V--V /.-'`||\\'-.'-.
27+
`'-'-.// || / .___. \ || \\.-'-'`
28+
`-.||_.._| |_.._||.-'
29+
\ (( )) /
30+
jgs '. .'
31+
`\/`
32+
```
33+
34+
[Here are some cubes](https://www.asciiart.eu/art-and-design/geometries).
35+
36+
```
37+
+------+. +------+ +------+ +------+ .+------+
38+
|`. | `. |\ |\ | | /| /| .' | .'|
39+
| `+--+---+ | +----+-+ +------+ +-+----+ | +---+--+' |
40+
| | | | | | | | | | | | | | | | | |
41+
+---+--+. | +-+----+ | +------+ | +----+-+ | .+--+---+
42+
`. | `.| \| \| | | |/ |/ |.' | .'
43+
`+------+ +------+ +------+ +------+ +------+'
44+
```
45+
46+
[And this one is a dog](https://www.asciiart.eu/animals/dogs).
47+
48+
```
49+
__
50+
\ ______/ V`-,
51+
} /~~
52+
/_)^ --,r'
53+
|b |b
54+
```
55+
56+
We call these drawings "ASCII Art" after the "American Standard Code for Information Interchange" - ASCII.
57+
ASCII defined an English-centric set of characters and how to represent them in a computer. Much of this early
58+
art was made solely using that character set, hence the name.
59+
60+
Even though sending images is now practical to do over the internet, ASCII art is still
61+
a valid form of expression. Either as a deliberate choice or because of using a text only medium
62+
(they still exist. Think of in-game chats.) ASCII art can be useful.
63+
64+
If you want to see how far this can be taken
65+
check out this [entirely ASCII art rendition of the Star Wars IV: A New Hope](https://www.asciimation.co.nz/index.php)
66+
67+
68+
69+
## Your Goal
70+
71+
Make a program that asks a user for a "height" and then prints out an ASCII art christmas tree
72+
that is that many characters tall.
73+
74+
Here is an example tree you can use as a starting point. You can print this when asked for a height of `3`.
75+
76+
```
77+
*
78+
***
79+
*****
80+
|
81+
```
82+
83+
Here is another example, but with a height of `5`.
84+
85+
```
86+
*
87+
***
88+
*****
89+
*******
90+
*********
91+
|
92+
```
93+
94+
And here it is with a height of `1`
95+
96+
```
97+
*
98+
|
99+
```
100+
101+
You want to make sure that if the person using your program gives you a negative number, zero, or something that is
102+
not a number you don't just crash. This means you might need to reprompt them for information.
103+
104+
105+
## Future Goals
106+
107+
* Draw something with more varied parts, like a snowman. You might find it convenient to not directly print to the screen, but instead "draw" what you want to print into an array first then print the contents of that array.
108+
109+
```
110+
---
111+
| |
112+
-----
113+
/ _ ^ \
114+
| * * |
115+
| V |
116+
\^___^/
117+
-------
118+
/ \
119+
* | | *
120+
* | | *
121+
* | | *
122+
* \-------/ *
123+
---------
124+
/ \
125+
| |
126+
| |
127+
| |
128+
| |
129+
\---------/
130+
```
131+
132+
* Make the christmas tree prettier. This will require "finding the pattern" in a more interesting piece of art, like [this example](https://www.asciiart.eu/holiday-and-events/christmas/trees).
133+
134+
```
135+
/\
136+
/\*\
137+
/\O\*\
138+
/*/\/\/\
139+
/\O\/\*\/\
140+
/\*\/\*\/\/\
141+
/\O\/\/*/\/O/\
142+
||
143+
||
144+
||
145+
```
146+
147+
148+
* Turn this into a command-line program that works similarly to the [cowsay](https://en.wikipedia.org/wiki/Cowsay#:~:text=cowsay%20is%20a%20program%20that,a%20cow%20with%20a%20message.) tool.
149+
150+
```
151+
_______
152+
< Hello >
153+
-------
154+
\ ^__^
155+
\ (oo)\_______
156+
(__)\ )\/\
157+
||----w |
158+
|| ||
159+
```

src/projects/calorie_tracker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The intent is to help them be intentional about the number of calories they are
3838

3939
We will count it as a success if the program you produce at least helps them track the total.
4040

41+
Hint: You will need to use `IO.readln` alongside `Integer.parseInt` and/or `Double.parseDouble`.
42+
4143
## Future Goals
4244

4345
When you learn enough to do the following, come back to this project and expand it.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Point of Sale System

src/standard_input_iii.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Standard Input III
File renamed without changes.

0 commit comments

Comments
 (0)