Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » The HwS Questions Directory
- AldgatePupil16
-
7 posts
The HwS Questions Directory
Chudi Studios Unleashed
And to to
@aldgatepupil16
@redname2
@red4elephant
@extras104
- Deplixed
-
45 posts
The HwS Questions Directory
1.6 2D lists2D lists, also known as 2D arrays, nested lists, or matrices, are a type of data structure that allows you to put an entire list as an element of another list; that is, it allows you to put lists inside of lists. These sorts of data structures are used widely in other programming languages and functions similarly to a table.
This block, and others, would allow you to create 2D lists to store information. However, this is too complicated for what is supposed to be an introductory programming language. There are workarounds possible by using an ordinary list and an indexing function. For those who are interested, it may be worth checking out Snap!. It is a block-based programming language designed for experienced programmers and has more advanced data structures than Scratch does.
add [] to sublist () of [list v] :: listView source
- forkmanb
-
100+ posts
The HwS Questions Directory
this isn't the place to put blocks. please test scratchblocks here:when green flag clicked
ask [Is this cool] and wait
https://scratch.mit.edu/discuss/topic/741323/
- MrInteractions
-
7 posts
The HwS Questions Directory
- -InsanityGames-
-
500+ posts
The HwS Questions Directory
(#209)In all seriousness though, is it okay if I take over this directory? I already own this Bugs and Glitches directory which uses automation, and this directory hasn't been updated in over a year.
An inactive directory? Intriguing…
- blah_blahYa
-
14 posts
The HwS Questions Directory
when green flag clicked
forever
if <(star and heart) = (clicked)> then
change [points] by((points) + (10))
end
Last edited by blah_blahYa (March 20, 2024 19:20:03)
- blah_blahYa
-
14 posts
The HwS Questions Directory
when green flag clicked
set [inputExpression v] to (3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3)
initialize [outputQueue v] to []
initialize [operatorStack v] to []
repeat (length of (inputExpression))
set [currentToken v] to (letter (i) of (inputExpression))
if <(currentToken) = [a number]> then
add (currentToken) to (outputQueue)
else
if <(currentToken) = [an operator]> then
repeat until <<(operatorStack) = []> or <(currentToken) has greater precedence than (top of (operatorStack))>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a left parenthesis]> then
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a right parenthesis]> then
repeat until <<(operatorStack's top) = [a left parenthesis]>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
remove (operatorStack's top) // Remove the left parenthesis
end
end
end
end
end
repeat until <<(operatorStack) = []>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
define push(item v) onto(stack v)
add (item) to (stack)
define remove top from(stack v)
delete (1) of (stack)
define top of(stack v)
(item (1) of (stack))
define has greater precedence than(item1 v) (item2 v)
<((item1) has greater precedence than (item2))>
define a number
<(currentToken) = [0] or (currentToken) = [1] or (currentToken) = [2] or (currentToken) = [3] or (currentToken) = [4] or (currentToken) = [5] or (currentToken) = [6] or (currentToken) = [7] or (currentToken) = [8] or (currentToken) = [9]>
define an operator
<((currentToken) = ["+"] or (currentToken) = ["-"] or (currentToken) = ["*"] or (currentToken) = ["/"] or (currentToken) = ["^"])>
define a left parenthesis
<(currentToken) = ["("]>
define a right parenthesis
<(currentToken) = [")"]>
Last edited by blah_blahYa (March 21, 2024 21:28:52)
- -InsanityGames-
-
500+ posts
The HwS Questions Directory
Didn't expect to casually find someone using my project here lol1.6 2D lists2D lists, also known as 2D arrays, nested lists, or matrices, are a type of data structure that allows you to put an entire list as an element of another list; that is, it allows you to put lists inside of lists. These sorts of data structures are used widely in other programming languages and functions similarly to a table.
This block, and others, would allow you to create 2D lists to store information. However, this is too complicated for what is supposed to be an introductory programming language. There are workarounds possible by using an ordinary list and an indexing function. For those who are interested, it may be worth checking out Snap!. It is a block-based programming language designed for experienced programmers and has more advanced data structures than Scratch does.
add [] to sublist () of [list v] :: listView source
Last edited by -InsanityGames- (March 21, 2024 21:22:33)
- DaBestCoconut
-
13 posts
The HwS Questions Directory
- BigNate469
-
1000+ posts
The HwS Questions Directory
- Oleksyshyn29
-
13 posts
The HwS Questions Directory
move () steps[scratchblocks]
turn cw () degrees
[/scratchblocks][scratchblocks]
backdrop #
[/scratchblocks]
- BluePixelLOLLL
-
1000+ posts
The HwS Questions Directory
when green flag clicked
set [inputExpression v] to (3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3)
initialize [outputQueue v] to []
initialize [operatorStack v] to []
repeat (length of (inputExpression))
set [currentToken v] to (letter (i) of (inputExpression))
if <(currentToken) = [a number]> then
add (currentToken) to (outputQueue)
else
if <(currentToken) = [an operator]> then
repeat until <<(operatorStack) = []> or <(currentToken) has greater precedence than (top of (operatorStack))>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a left parenthesis]> then
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a right parenthesis]> then
repeat until <<(operatorStack's top) = [a left parenthesis]>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
remove (operatorStack's top) // Remove the left parenthesis
end
end
end
end
end
repeat until <<(operatorStack) = []>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
define push(item v) onto(stack v)
add (item) to (stack)
define remove top from(stack v)
delete (1) of (stack)
define top of(stack v)
(item (1) of (stack))
define has greater precedence than(item1 v) (item2 v)
<((item1) has greater precedence than (item2))>
define a number
<(currentToken) = [0] or (currentToken) = [1] or (currentToken) = [2] or (currentToken) = [3] or (currentToken) = [4] or (currentToken) = [5] or (currentToken) = [6] or (currentToken) = [7] or (currentToken) = [8] or (currentToken) = [9]>
define an operator
<((currentToken) = ["+"] or (currentToken) = ["-"] or (currentToken) = ["*"] or (currentToken) = ["/"] or (currentToken) = ["^"])>
define a left parenthesis
<(currentToken) = ["("]>
define a right parenthesis
<(currentToken) = [")"]>
when green flag clickedhuh
set [inputExpression v] to (3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3)
initialize [outputQueue v] to []
initialize [operatorStack v] to []
repeat (length of (inputExpression))
set [currentToken v] to (letter (i) of (inputExpression))
if <(currentToken) = [a number]> then
add (currentToken) to (outputQueue)
else
if <(currentToken) = [an operator]> then
repeat until <<(operatorStack) = []> or <(currentToken) has greater precedence than (top of (operatorStack))>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a left parenthesis]> then
push (currentToken) onto (operatorStack)
else
if <(currentToken) = [a right parenthesis]> then
repeat until <<(operatorStack's top) = [a left parenthesis]>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
remove (operatorStack's top) // Remove the left parenthesis
end
end
end
end
end
repeat until <<(operatorStack) = []>>
add (operatorStack's top) to (outputQueue)
remove (operatorStack's top)
end
define push(item v) onto(stack v)
add (item) to (stack)
define remove top from(stack v)
delete (1) of (stack)
define top of(stack v)
(item (1) of (stack))
define has greater precedence than(item1 v) (item2 v)
<((item1) has greater precedence than (item2))>
define a number
<(currentToken) = [0] or (currentToken) = [1] or (currentToken) = [2] or (currentToken) = [3] or (currentToken) = [4] or (currentToken) = [5] or (currentToken) = [6] or (currentToken) = [7] or (currentToken) = [8] or (currentToken) = [9]>
define an operator
<((currentToken) = ["+"] or (currentToken) = ["-"] or (currentToken) = ["*"] or (currentToken) = ["/"] or (currentToken) = ["^"])>
define a left parenthesis
<(currentToken) = ["("]>
define a right parenthesis
<(currentToken) = [")"]>
Last edited by BluePixelLOLLL (April 24, 2024 04:24:17)
- Kingsharpblade23
-
5 posts
The HwS Questions Directory
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
when I receive [ v]
- 4w350m3g4m3r79
-
22 posts
The HwS Questions Directory
Last edited by 4w350m3g4m3r79 (May 13, 2024 17:22:58)
- Discussion Forums
- » Help with Scripts
-
» The HwS Questions Directory