Background
This is a standard textbook example to demonstrate for loops.
This is one of the first programs I learnt when I started learning programming ~10 years ago.
Task
You are to print this exact text:
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
Specs
- You may have extra trailing newlines.
- You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.
Scoring
This is code-golf. Shortest answer in bytes wins.
-
3\$\begingroup\$ @DylanMeeus "You are to print this exact text:" \$\endgroup\$Leaky Nun– Leaky Nun2016年08月04日 12:56:25 +00:00Commented Aug 4, 2016 at 12:56
-
16\$\begingroup\$ @DylanMeeus Since that is to do with the dev tools hiding repeated console outputs, and isn't native to JavaScript consoles as a whole and is not in the JavaScript spec - as well as the fact that feature can be turned off - i think it should be acceptable. Not all browsers will collapse it like that. \$\endgroup\$James T– James T2016年08月04日 12:58:40 +00:00Commented Aug 4, 2016 at 12:58
-
9\$\begingroup\$ @LeakyNun Leaderboard snippet please! \$\endgroup\$anna328p– anna328p2016年08月04日 22:08:46 +00:00Commented Aug 4, 2016 at 22:08
-
4\$\begingroup\$ One of the most interesting things about this challange is that depending on your language ********** can be shorter then a loop. Makes me wonder when it's better for a given language to switch between 1 or 2 loops. \$\endgroup\$dwana– dwana2016年08月05日 09:14:22 +00:00Commented Aug 5, 2016 at 9:14
-
3\$\begingroup\$ you say trailing new lines are acceptable. Are leading newlines acceptable too? \$\endgroup\$Albert Renshaw– Albert Renshaw2017年02月10日 02:34:47 +00:00Commented Feb 10, 2017 at 2:34
420 Answers 420
JVM Bytecode, 309 bytes
Hexdump output because the entire file is hex:
00000000 ca fe ba be 00 03 00 2d 00 15 01 00 16 28 5b 4c |.......-.....([L|
00000010 6a 61 76 61 2f 6c 61 6e 67 2f 53 74 72 69 6e 67 |java/lang/String|
00000020 3b 29 56 01 00 08 74 6f 53 74 64 6f 75 74 07 00 |;)V...toStdout..|
00000030 13 07 00 0c 01 00 26 28 4c 6a 61 76 61 2f 6c 61 |......&(Ljava/la|
00000040 6e 67 2f 53 74 72 69 6e 67 3b 29 4c 6a 61 76 61 |ng/String;)Ljava|
00000050 2f 6c 61 6e 67 2f 53 74 72 69 6e 67 3b 01 00 06 |/lang/String;...|
00000060 63 6f 6e 63 61 74 01 00 04 43 6f 64 65 01 00 04 |concat...Code...|
00000070 6d 61 69 6e 01 00 0a 53 6f 75 72 63 65 46 69 6c |main...SourceFil|
00000080 65 0c 00 06 00 05 0c 00 02 00 12 01 00 10 6a 61 |e.............ja|
00000090 76 61 2f 6c 61 6e 67 2f 53 74 72 69 6e 67 0a 00 |va/lang/String..|
000000a0 03 00 0b 01 00 0b 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |......**********|
000000b0 0a 08 00 0e 0a 00 04 00 0a 07 00 07 01 00 15 28 |...............(|
000000c0 4c 6a 61 76 61 2f 6c 61 6e 67 2f 53 74 72 69 6e |Ljava/lang/Strin|
000000d0 67 3b 29 56 01 00 15 73 75 6e 2f 6d 69 73 63 2f |g;)V...sun/misc/|
000000e0 4d 65 73 73 61 67 65 55 74 69 6c 73 01 00 00 00 |MessageUtils....|
000000f0 20 00 11 00 03 00 00 00 00 00 01 00 09 00 08 00 | ...............|
00000100 01 00 01 00 07 00 00 00 22 00 03 00 01 00 00 00 |........".......|
00000110 16 12 0f 59 b6 00 10 59 59 b6 00 10 59 b6 00 10 |...Y...YY...Y...|
00000120 b6 00 10 b8 00 0d b1 00 00 00 00 00 01 00 09 00 |................|
00000130 00 00 02 00 14 |.....|
00000135
To minimize size, I:
- Used the classs name "Code" to avoid putting another entry into the constant table
Set the SourceFile to an empty string
Used sun.misc.MessageUtils.toStdout() rather than System.out.println() to avoid an extra get static instruction, which also let me avoid having to juggle to keep it on the stack
- Used exponentially growing dups and String.concat() rather than having a loop
- Extended the class from sun.misc.MessageUtils to avoid having an entry for java.lang.Object on the stack
The jasmin assembler code used to generate this class is:
.source ""
.class Code
.super sun/misc/MessageUtils
.method public static main([Ljava/lang/String;)V
.limit stack 3
ldc "**********\n"
dup
invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
dup
dup
invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
dup
invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
invokestatic sun/misc/MessageUtils/toStdout(Ljava/lang/String;)V
return
.end method
and the CFR decompiler output for this class is:
/*
* Decompiled with CFR 0_125.
*/
import sun.misc.MessageUtils;
class Code
extends MessageUtils {
public static void main(String[] arrstring) {
String string = "**********\n".concat("**********\n");
String string2 = string.concat(string);
MessageUtils.toStdout(string.concat(string2.concat(string2)));
}
}
Wumpus, 22 bytes
)"*"9&=l(&o
}@?!-)9=N}
Explanation:
) increment the counter
"*" push an asterisk to the stack
9&= Duplicate it 9 times (leaving 10 copies)
l(&o Print length of stack-1 times
Reflect off the end of the line and go South-West
} Turn right by 60 degrees, now going West along the second line
N Print a newline
= Duplicate the counter
!-)9 Check if it is equal to 10
@? If so, end the program
} Else turn right and go back to the start of the first line
Keg, 10 bytes
(
|(
|\*)
)
Explanation
(\n| Start for loop iterating 10 times
(\n| Start for loop iterating 10 times
\* Push an asterisk
) End loop
\n Push a newline
-
\$\begingroup\$ Apparently the final
)is not needed, only the newline in front of it. At least for the TIO version. \$\endgroup\$manatwork– manatwork2019年10月14日 14:20:03 +00:00Commented Oct 14, 2019 at 14:20
CSS, (削除) 157 (削除ここまで) 109 bytes
Inspired by hd answer, probably 1:1 reproduced from OP question (except background color) - pure CSS solution (no additional HTML)
body:after,body:before{white-space:pre;content:'**********\A**********\A**********\A**********\A**********\A'
-
4\$\begingroup\$ 103 bytes:
*,:after{margin:0;white-space:pre;content:'**********\A**********\A**********\A**********\A**********\A(FireFox only, save it inside<style>...</style>in a totally empty file), the:aftermatches every element's after (in this case html and body) and*is used to remove the body margin. \$\endgroup\$Night2– Night22019年10月15日 05:43:55 +00:00Commented Oct 15, 2019 at 5:43
Mornington Crescent, 1940 bytes
Take Northern Line to Euston
Take Victoria Line to Seven Sisters
Take Victoria Line to Euston
Take Victoria Line to Euston
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminal 5
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Bakerloo Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
// "*" = 42 = 6*7
// get 7
Take Northern Line to Euston
Take Victoria Line to Seven Sisters
// copy it
Take Victoria Line to Euston
Take Victoria Line to Euston
Take Northern Line to Bank
// add it until 42
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
// get char "*"
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
// concatenate it (shorter than with loop)
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
// calculate a 10 for newline
// get 5 from Heathrow Terminal 5
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminal 5
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
// add 5 + 5
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
// get char "\n"
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
// concatenate it with asterisks
Take Bakerloo Line to Paddington
// copy them
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
// go home and print
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
Flurry, 76 bytes
({<(<({})(<({}){}>){}>){}>}){(({}){(){}(((<><<>()>){})[{}{<({}){}>}])}{})}{}
Can be run with the interpreter as follows:
$ ./Flurry -bnn -c "$pgm"
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
Explanation
A function that composes two functions (or multiplies two numbers):
comp = λf g x. f (g x)
= λf g x. K f x (g x)
= λf g x. S (K f) g x
= λf. S (K f)
= S ∘ K
:= <<>()>
A function that increments a number by one:
succ = λn f x. f (n f x)
= λn f. comp f (n f)
= λn f. S comp n f
= S comp
:= <><<>()>
A function that computes n(n + 1):
oblong = λn. n * succ n
= λn. comp n [succ n]
= λn. S comp succ n
= succ succ
:= <><<>()> [<><<>()]
:= (<><<>()>) {}
The number two:
2 = λf x. f (f x)
= λf. <f f>
:= {<({}){}>}
The number six:
6 = 2 * 3
= 2 * succ 2
= oblong 2
:= oblong {<({}){}>}
:= (<><<>()>){} {<({}){}>}
The number 42 (ASCII value of *):
42 = 6 * 7
= 6 * succ 6
= oblong 6
= oblong (oblong 2)
:= (oblong) [{} 2]
:= ((<><<>()>){}) [{} 2]
:= ((<><<>()>){}) [{} {<({}){}>}]
The number 10:
10 = λf x. f (f (f (f (f (f (f (f (f (f x)))))))))
= λf. f ∘ f ∘ f ∘ f ∘ f ∘ f ∘ f ∘ f ∘ f ∘ f
= λf. push (f ∘ f ∘ f ∘ f ∘ f) ∘ pop
= λf. push (f ∘ push (f ∘ f) ∘ pop) ∘ pop
= λf. push (push f ∘ push (push pop ∘ pop) ∘ pop) ∘ pop
:= {< ( < ({}) ( < ({}) {}>) {}>) {}>}
:= {<(<({})(<({}){}>){}>){}>}
A function that pushes 42 to the stack and returns its argument:
push_star = λx. (push 42; x)
= λx. K x (push 42)
:= {() {} (42)}
:= {() {} (((<><<>()>){})[{}{<({}){}>}])}
A function that takes the number 10 and then pushes ten copies of 42, followed by 10, and returns 10:
push_row = λn. push (n push_star n)
:= { (({}) push_star {}) }
:= { (({}) {(){}(((<><<>()>){})[{}{<({}){}>}])} {}) }
Applying push_row 10 times to the number 10:
main () = 10 push_row 10
= (push 10) push_row pop
:= (10) push_row {}
:= ({<(<({})(<({}){}>){}>){}>}){(({}){(){}(((<><<>()>){})[{}{<({}){}>}])}{})}{}
Cubix, 26 bytes
'*u.NNw\./>rroq(?;([email protected]
This maps onto a side length 3 cube. Now to try and get rid of some of the no-ops and try and fit it on a side length 2 cube.
' * u
. N N
w \ .
/ > r r o q ( ? ; ( ? @
. . . . N . . . . . . .
. . . . . . . . . . . .
. . .
. . .
. . .
/Redirect the flow to the top face'*uAdd an * to the stack and u-turnNNAdd a couple of 10's to the stack as counters>rroqRotate the stack to bring the * to the top, output and push it to the bottom(?Decrement the top counter (character) and test.- If zero
;(pop from stack, decrement next counter (line), otherwise go around to previous command set. ?@Test the counter (line) and exit if zeroNo\wAdd a 10 to the stack as a linefeed and a new character counter, output it and redirect back to the>to start the sequence again.
x86-16 machine code, IBM PC DOS, 17 bytes
00000000: b10a 8bd1 b82a 0acd 1088 c8cd 294a 75f4 .....*......)Ju.
00000010: c3 .
Listing:
B1 0A MOV CL, 10 ; repeat '*' 10 times per line
8B D1 MOV DX, CX ; counter for 10 line loop
LINE_LOOP:
B8 0A2A MOV AX, 0A2AH ; AL = '*', AH = 0AH
CD 10 INT 10H ; print '*' 10 times
88 C8 MOV AL, CL ; AL = LF char (0xA)
CD 29 INT 29H ; write to screen
4A DEC DX ; dec counter
75 F4 JNZ LINE_LOOP ; loop for 10 lines
C3 RET ; return to DOS
Uses PC BIOS INT 10H function 0AH (write char at current position CX number of times) for each row. Since this function doesn't actually advance the cursor only a line feed/LF (0xA) char is needed to move to the next line.
-
\$\begingroup\$ need to print
*notx\$\endgroup\$roblogic– roblogic2021年03月15日 01:03:48 +00:00Commented Mar 15, 2021 at 1:03 -
1\$\begingroup\$ @roblogic: Thanks for your hint. It was only a small change, of course. \$\endgroup\$Donat– Donat2021年03月15日 09:04:29 +00:00Commented Mar 15, 2021 at 9:04
Excel, (削除) 10 (削除ここまで) 8 keystrokes
In a fresh empty sheet,
Ctrl+GJ10EnterCtrl+Shift+Home*Ctrl-Shift-Enter
Explanation:
- Ctrl+G is a shortcut for the GoTo dialog
- Entering J10 goes to that cell
- Enter closes the dialog
- Ctrl+Shift+Home expands the selection to A1, making a grid of 10x10 cells
- Then we put in the asterisk
- Ctrl+Shift+Enter (instead of plain Enter) fills in the input over all selected cells
RAMDISP, 31 bytes.
[P[5[*2]R[M[I[;**********
]]]]]
[P - pipe through the following array
[
5 - 5
[*2] - times 2 [10]
R - create a range of that size [1..10]
[M - for each element in that range
[I - ignore it
[;**********\n] - print eight asterisks and a newline
(real newline was replaced by \n)
]
]
]
]
basic, but works.
-
1\$\begingroup\$ Out of interest, did you make this language? \$\endgroup\$2021年06月25日 08:19:04 +00:00Commented Jun 25, 2021 at 8:19
-
\$\begingroup\$ @RedwolfPrograms yes! but i made it before i even joined stackexchange so i dont think it's cheating \$\endgroup\$Pro Odermonicon– Pro Odermonicon2021年06月27日 20:57:21 +00:00Commented Jun 27, 2021 at 20:57
-
1\$\begingroup\$ It wouldn't be cheating either way! In fact, I've got a bounty of +100 reputation for new(ish) languages, and this one looks really interesting. \$\endgroup\$2021年06月27日 20:59:44 +00:00Commented Jun 27, 2021 at 20:59
05AB1E, 6 bytes
×ばつv,
'* character literal: "*"
×ばつ repeat ten times as a string: "**********"
v for each character y in this string:
, print the top of stack. As the stack is empty and there is no input, this uses the value that was previously on the stack, "**********".
51AC8, 10 bytes
×ばつt]
Explanation
×ばつt]
10 # Push 10 (for each loop; looping var)
[ # Begin foreach loop (for 10 times)
10 # Push 10
\* # Push '*'
×ばつ # Multiply
t # Pop and print
] # End foreach
K (ngn/k), (削除) 16 (削除ここまで) (削除) 14 (削除ここまで) 13 bytes
` 0:10 10#"*"
Thanks to @Bubbler in the k tree for helping me out with this.
̄2 bytes thanks to @Bubbler
̄1 byte thanks to @Bubbler
Vyxal, jH, (削除) 6 (削除ここまで) (削除) 5 (削除ここまで) 4 3 bytes
×ばつ*2
Explained
×ばつ* # Push 100 asterisks onto the stack (as a single string) // the H flag initalises the stack with 100
2 # Split into pieces of 10 and use the j flag to join on newlines.
Alternatively:
Vyxal, 5 bytes
×ばつ*2⁋
Elixir, 35 bytes
for _<-0..9,do: IO.puts"**********"
Originally suggested to @Chester Lynn on their answer.
INTERCAL, 109 bytes
Wait, no, I don't even need to make a loop.
PLEASE,1<-#11DO,1SUB#1<-#172DO,1SUB#11<-#260PLEASEREADOUT,1DO,1SUB#1<-#252DOREADOUT,1+,1+,1+,1+,1+,1+,1+,1+,1
INTERCAL, 116 bytes
mindoverflow said as if they can't loop shorter, but actually you can.
The code below uses .1 as loop counter.
Starting with .1<-512,
iteration is done with DOCOMEFROM.1~.1 and (1)DO.1<-.1~#1022.
PLEASE,1<-#11DO,1SUB#1<-#172DO,1SUB#11<-#260DO.1<-#512DOCOMEFROM.1~.1PLEASEREADOUT,1DO,1SUB#1<-#252(1)DO.1<-.1~#1022
CLC-INTERCAL, 114 bytes.
From this how should I golf off....
DO;1<-#1DO;1SUB#1<-#121DO,1<-#1DO.1<-#512DOCOMEFROM.1~.1DOREADOUT;1+;1+;1+;1+;1+;1+;1+;1+;1+;1+,1(1)DO.1<-.1~#1022
-
\$\begingroup\$ No, I can't. Though I could do double-loops with
DOSTASH.1DO.1<-#0andDORETRIEVE.1,DOREADOUT,~#1022, and some similar code appears twice, which makes it longer. \$\endgroup\$user100411– user1004112021年09月16日 12:42:28 +00:00Commented Sep 16, 2021 at 12:42
Python 3, (削除) 25 (削除ここまで) 24 bytes
-1 byte thanks to @Jo King
*map(print,['*'*10]*10),
Unpacks the map object so it actually prints the output, instead of optimising it away.
Cascade, (削除) 32 (削除ここまで) 27 bytes
"
*
*
*
*@
*}
*|
*/
*
*.
*/
Aha! It turns out just printing ten asterisks ten times does beat out my more complex answer. Unfortunately though, writing this program exposed not one, but two bugs in my interpreter. Below is my longer, but higher effort solution:
Cascade, 32 bytes
_9'2
^*|
\ !]
(.n
n?\
\%!|
n)+\
One of my more compact Cascade programs. I'm still not sure if it would be shorter to just print 10 asterisks 10 times instead of using a counter, but I'm satisfied with this, especially how the bottom intersects with the top.
Explanation
The easiest way to understand the code is know the basic structure. Each instruction can take up to three inputs, each one below it.
+
lcr
These are the left, center and right arguments. In this case, the + instruction is dyadic, meaning it takes the left and right arguments. Most instructions are either dyadic or monadic (taking one argument, the center one). The /\| instructions take only the argument they are pointing to, and the ! instructions skips over the center and takes the argument two below it. Each of these arguments can themselves be code instructions, meaning they chain together in a prefix like notation. For example, this code could be represented by the recursive Lisp-like code:
code = (if (0==(n=dec n))
doboth
(print (
if (% n (+9 2)) ('*')
else (inc 9)
))
(code)
)
If that doesn't make sense, here's an expanded look at the code, which is still a little confusing, but it at least has an idea of which parts are connected to each other through the |/\Xs. Note that the top and bottom rows are the overlap between the two (and same with the left and right).
\ |/|\ \
_ 9 ' 2
/ \ | /
^ * |
/ \ |
\ ! ]
\ \ \/ \
( . n/
| | |
n ? \
/|\ \
\ % ! |
X \\ |
n ) +/\
\ |/|\ \
Starting from the top left corner, we have the first check (_) which executes the right branch only if the left is successful. The left goes down to the ], which sets the n variable (initially 110) to the decrement (() of n, i.e. n=n-1. The check then takes the result of this (the new value of n) and continues if it is positive. This moves onto the branch instruction on the right (^), which executes both the left and right branches.
The left prints (.) the value given by the choice instruction (?). This branches depending on the center value, which is the modulo (%) of n and the addition (+) of 9 and 2. Note that this wraps around to the top again for those digits. If n%(9+2) is 0, then we branch left, which navigates around the % and returns the increment ()) of 9, printing a newline. If it is not divisible by 11, then we go right, skip over the + with a !, and return the character (') of * to print.
Now the right branch of the ^ skips over the n, then goes right, down, and right again, wrapping around both the right edge and the bottom edge to loop back to the _ in the top left. This now loops over the exact same code until n has reached 0, printing ten asterisks and then a newline.
Minim, (削除) 42 37 (削除ここまで) 35 Bytes
New solution halts by checking if [0] > 99.
$<42._^++[0]%10.$<10._^[0]>99.C=-1.
With whitespace and comments:
$< 42. ; Print 42 as unicode '*'
_^ ++[0] % 10. ; Increment index 0 and skip next stmt if index 0 mod 10 is nonzero
$< 10. ; Print 10 as unicode '\n'
_^ [0] > 99. ; Skip next stmt if index 0 is greater than 99
C = -1. ; Set program counter to -1 (advances to 0 afterwards)
Old solutions halted by checking [0] == 100...
$<42._^++[0]%10.$<10._^[0]==100.C=-1.
... or used labels and gotos.
_>1.$<42._^++[0]%10.$<10._<?([0]-100)._>0.
-
1\$\begingroup\$ Nice answer! Did you make this language? (Also, welcome to Code Golf!) \$\endgroup\$2021年08月13日 03:27:41 +00:00Commented Aug 13, 2021 at 3:27
-
\$\begingroup\$ @RedwolfPrograms Thank ya kindly~ Yes indeed! This is an old esolang (2017) that I resurrected last month, and have been in the process of finishing. I didn't do too bad for my first entry, I suppose! And thank you~ \$\endgroup\$Christian Alexander– Christian Alexander2021年08月13日 03:37:59 +00:00Commented Aug 13, 2021 at 3:37
-
\$\begingroup\$ Also just realized that my program's size is the ASCII value of the asterisk! How serendipitous~ \$\endgroup\$Christian Alexander– Christian Alexander2021年08月13日 04:11:30 +00:00Commented Aug 13, 2021 at 4:11
-
1\$\begingroup\$ When I went to the esolangs article, I instantly recognised this as being from Truttle server. Welcome to the wonderful world of Code Golf! \$\endgroup\$2021年08月13日 11:17:57 +00:00Commented Aug 13, 2021 at 11:17
Flobnar, 27 bytes
6v|<
+|_,
4|<v|@
7, |
*< |<
Same but abusing vertical if |.
Flobnar, 32 bytes
7 009
*,!__<
6 0^|<
>___,+
^!|@
The ultimate abuse of the behavior of _:
'Horizontal if', denoted
_, checks what the cell on the other side of it evaluates to. If that value is nonzero, it evaluates to what the cell west of it evaluates to; otherwise, it evaluates to what the cell east of it evaluates to. In either case, at most two evaluations are made.
If _ is entered horizontally, it can be used to evaluate the other side twice, or various numbers of times if chained with other _s and/or horizontal arrows.
The first half (printing * 10 times) works like this:
7
*,! Print an asterisk and return 1
6
7 00
*,!__< Print asterisk 10 times (enter at the lower right corner):
6 ^|<
| Check if the west returns nonzero value
^ evaluate north
_ evaluate other side, which is 0; evaluate east
_ evaluate other side:
< evaluate west
_ evaluate other side:
_ evaluate other side:
..! print * and return 1
nonzero, so evaluate west
..! print * and return 1
nonzero, so evaluate west
_ evaluate other side: (repeat; * is printed 4 times so far)
nonzero, so evaluate west
_ evaluate other side: (repeat; * is printed 6 times so far)
nonzero, so evaluate north of |
_ the other side is 0, so go right to < (repeat; * is printed 10 times in total)
The other half (going through the large loop 10 times) is more straightforward, so figuring out that part is left for the exercise to the reader.
Flobnar, 40 bytes
d1_ +
@+|\<\
::
g- < >
:1 6
%9>*>
>+,7_,
More explicitly controlled loop. gets 100 (d) from the position (0, 0) of the grid, and repeats that many times, printing * at every iteration and a newline every 10 loops.
Java, (削除) 103 Bytes (削除ここまで)   92 Bytes
class Main{public static void main(String[]a){System.out.print("**********\n".repeat(10));}}
-
4\$\begingroup\$ Welcome to code golf, and nice first answer! You can remove the space between
String[]andargs, and it’s shorter to in-line the"**********\n"string, so you can reduce this code to 95 bytes: Try it online! \$\endgroup\$noodle person– noodle person2023年09月28日 16:39:14 +00:00Commented Sep 28, 2023 at 16:39
Nibbles, (削除) 13 (削除ここまで) 12 nibbles (6.0 bytes)
^10: ^10"*" "\n"
Explanation
^10: ^10"*" "\n" #
----------------------------------------
^10"*" # replicate 10 times
: "\n" # append
^10 # replicate 10 times
-1 Nibble thanks to xigoi
-
\$\begingroup\$ Nibbles is getting pretty competitive these days... \$\endgroup\$Dominic van Essen– Dominic van Essen2023年03月21日 11:09:43 +00:00Commented Mar 21, 2023 at 11:09
-
\$\begingroup\$ true... I just found an answer where someone linked ATO for Nibbles, so I just added that to my existing answers :D \$\endgroup\$sfieger– sfieger2023年03月21日 12:24:26 +00:00Commented Mar 21, 2023 at 12:24
-
\$\begingroup\$ You can use
"\n"instead of'\n'for -1 nibble (string literals are cheaper than character literals). \$\endgroup\$Adamátor– Adamátor2023年09月23日 21:14:30 +00:00Commented Sep 23, 2023 at 21:14
Uiua, 10 bytes
≡&p↯⊂.10@*
≡&p↯⊂.10@* full program
@* the character literal '*'
⊂.10 the golfiest way to produce the dimensions of the matrix [10,10]
↯ reshape to get 10x10 matrix of '*'s
≡&p print each row with newline
Python 3, (削除) 29 (削除ここまで) 23 bytes
print(('*'*10+'\n')*10)
Thanks to orlp for shaving off 6 bytes.
-
1\$\begingroup\$ We require either a full program or a function. An expression is not sufficient. \$\endgroup\$orlp– orlp2016年08月04日 09:35:43 +00:00Commented Aug 4, 2016 at 9:35
-
\$\begingroup\$ Yes, I'm referring to your second paragraph. \$\endgroup\$orlp– orlp2016年08月04日 09:36:50 +00:00Commented Aug 4, 2016 at 9:36
-
1\$\begingroup\$
print((10*"*"+"\n")*10)is shorter. \$\endgroup\$orlp– orlp2016年08月04日 09:37:10 +00:00Commented Aug 4, 2016 at 9:37 -
\$\begingroup\$ darnit we had the same answer :( \$\endgroup\$Destructible Lemon– Destructible Lemon2016年08月04日 09:50:45 +00:00Commented Aug 4, 2016 at 9:50
-
\$\begingroup\$ Changing
printtoexitwill save 1 byte and still output the result, there wasn't specified if it should be printed on standard output. \$\endgroup\$Gábor Fekete– Gábor Fekete2016年08月04日 13:50:41 +00:00Commented Aug 4, 2016 at 13:50
Racket, 52 bytes
(display(string-join(make-list 10"**********")"\n"))
If you're fine with just returning the string and not printing it, you can forego the (display) for a score of 41 bytes.
An alternate answer (longer at 73 bytes, but I like it better personally):
(display(build-string 110(λ(n)(if(eq?(remainder n 10)0)#\newline #\*))))
-
\$\begingroup\$ Congratulations! \$\endgroup\$Leaky Nun– Leaky Nun2016年08月04日 10:29:51 +00:00Commented Aug 4, 2016 at 10:29
-
\$\begingroup\$ @LeakyNun For what? \$\endgroup\$TuxCrafting– TuxCrafting2016年08月04日 10:30:33 +00:00Commented Aug 4, 2016 at 10:30
-
\$\begingroup\$ For developing a language. \$\endgroup\$Leaky Nun– Leaky Nun2016年08月04日 10:30:41 +00:00Commented Aug 4, 2016 at 10:30
-
\$\begingroup\$ @LeakyNun Just look at my GitHub repos... \$\endgroup\$TuxCrafting– TuxCrafting2016年08月04日 10:35:11 +00:00Commented Aug 4, 2016 at 10:35
-
7\$\begingroup\$ I didn't say "for developing your first language" \$\endgroup\$Leaky Nun– Leaky Nun2016年08月04日 10:35:31 +00:00Commented Aug 4, 2016 at 10:35
C#, 79 bytes
class P{void Main(){for(int i=0;i++<10;)System.Console.Write("**********\n");}}
-
\$\begingroup\$ This won't run without
static voidright? \$\endgroup\$pay– pay2016年08月04日 15:49:35 +00:00Commented Aug 4, 2016 at 15:49 -
\$\begingroup\$ @pay has
voidalready not sure if it needsstaticwill check later when I have chance \$\endgroup\$TheLethalCoder– TheLethalCoder2016年08月04日 15:59:36 +00:00Commented Aug 4, 2016 at 15:59