# Genuary2024_NewLibrary

# PuzzleScripting

The prompt for **Genuary 2024 Day 21 is New Library**

PuzzleScripting was coded with the game dev library: **PuzzleScript** and for Audio**: SonicPi**

## Poem

```ocaml
What is the Puzzle in this piece?
Is it what it seems?
Does the glitch alter the scene
Or enhance, how it gleams?
```

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/pBJjnD747ik?si=pQKzTI61Idh3e6zM"></iframe>

## Code

### PuzzleScript

```javascript
title Colorfull Entity based on Eye Eye Eye 
(https://www.puzzlescript.net/editor.html?demo=sokoban_basic_)
author illestpreacha


========
OBJECTS
========

Background
silver red green yellow
20110
02301
21103
01211
10302

Target
lightgreen
.....
.000.
.0.0.
.000.
.....

Wall
brown darkbrown red
00010
12211
01000
12121
00020

Player
black orange white blue
.000.
.111.
22222
.333.
.3.3.


PlayerShadow
black orange white blue
.000.
.111.
22222
.333.
.3.3.


Alien1
purple blue red
.000.
00100
02212
20202
.202.

Alien2
darkblue red purple white
.303.
00100
02312
20202
.302.


Alien3
darkblue white black
.000.
00100
02212
20202
.202.


Crate
white black
01000
0...1
0...1
1...0
10100


=======
LEGEND
=======

. = Background
# = Wall
P = Player
F = Alien1
G = Alien2
H = Alien3
C = Crate
S = PlayerShadow

=======
SOUNDS
=======

sfx0 67117309

================
COLLISIONLAYERS
================

Background
Target
Player, Wall, Alien1, Alien2, Alien3, PlayerShadow
Crate

======
RULES
======

[ Alien1 | ... | Player ] -> [ > Alien1 | ... | Player ] sfx0
[ Alien2 | ... | Player ] -> [ > Alien2 | ... | Player ] sfx0
[ Alien3 | ... | Player ] -> [ > Alien3 | ... | Player ] sfx0


[ > Player | Crate ] -> [ > Player | > Crate ]
[ > Player ] [ PlayerShadow ] -> [ > Player ] [ > PlayerShadow ]
[ > Alien3 | Crate ] -> [ > Alien3 | > Crate ]

==============
WINCONDITIONS
==============



=======
LEVELS
=======

###############
#...S.......S.#
#....F....H...#
#.P....C......#
#......G......#
#H...G.......H#
#......S......#
#...S...G..F..#
#.C........C..#
#...S...G.....#
###############
```

### SonicPi

```ruby
require "C:/SonicPi/LibraryMaking/Ochestra.rb"



live_loop :chords do
  
  use_random_seed Math.cbrt(Time.now.to_i)
  
  use_bpm 120
  
  chordsChoose([:c4,:f4],:minor,:major,[:c5,:c5].tick,0,dice(3))
  chordsTick([:d3,:f3],:major,:major,[:f4,:d4].choose,2,1)
  
  sleep [ 0.5,1,2].choose
  
end


live_loop :ochestra do
  
  use_random_seed Math.cbrt(Time.now.to_i)
  
  use_bpm 35
  
  arrangement(:piano,60,:hpf,0.2,0.4,:arrangement1,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
  arrangement([:fm,:prophet,:pretty_bell].choose,30,:lpf,0.3,0.5,:arrangement2,:ixi_techno,:gverb,:ixi_techno,:krush)
  arrangement(:piano,30,:hpf,rrand(0.2,0.3),0.4,:arrangement3,:ixi_techno,:pitch_shift,:ixi_techno,:krush)
  arrangement(:piano,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement4,:ixi_techno,:vowel,:ixi_techno,:ixi_techno)
  arrangement([:fm,:prophet,:pretty_bell].choose,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement5,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
  arrangement(:chipbass,30,:vowel,rrand(0.1,0.3),0.5,:arrangement6,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
  arrangement(:dark_ambience,45,:whammy,rrand(0.2,0.7),0.4,:arrangement7,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
  arrangement(:chipbass,15,:vowel,rrand(0.3,0.5),0.5,:arrangement8,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
  
  sleep [0.5,1,2].choose
  
end
```
