CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 12:39:51 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=39ee976658f2426c86d67075b32f0a969a1ec79667177c6bbc414182e5dcfa19a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22p_3E1nRVCZILOEZd9MuqWckNie_aocSP%22%3B%7D; HttpOnly; Path=/
cf-ray: 98ce6c31e8fa1f95-BLR
Day 5 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Starting state of the stacks
- start_stacks([[n,z],[d,c,m],[p]]).
- % move(Sequence, NumberOfCrates, FromStack, ToStack).
- move(1,1,2,1).
- move(2,3,1,3).
- move(3,2,2,1).
- move(4,1,1,2).
- % Replace element number Counter in the List with Y.
- replace([_|L], 1, Y, [Y|L]).
- replace([X|L], Counter, Y, [X|Result]) :- NextCounter is Counter - 1, replace(L, NextCounter, Y, Result).
- % Stacks
- pop([X|L], X, L).
- push(X, L, [X|L]).
- % Transfer Counter crates from one list to the other
- transfer(0, FromList, ToList, FromList, ToList).
- transfer(Counter, FromList, ToList, FromResult, ToResult) :- pop(FromList, Crate, RestFromList), push(Crate, ToList, IncreasedToList), NextCounter is Counter - 1, transfer(NextCounter, RestFromList, IncreasedToList, FromResult, ToResult).
- % Do a single move
- move_crates(InitialState, NumberOfCrates, FromStack, ToStack, ResultState) :- nth(FromStack, InitialState, FromList), nth(ToStack, InitialState, ToList), transfer(NumberOfCrates, FromList, ToList, ResultFromList, ResultToList), replace(InitialState, FromStack, ResultFromList, BetweenState), replace(BetweenState, ToStack, ResultToList, ResultState).
- % Do a sequence of moves
- execute_move([], State, State).
- execute_move([Counter|L], InState, OutState) :- move(Counter, NumCrates, FromStack, ToStack), move_crates(InState, NumCrates, FromStack, ToStack, BetweenState), execute_move(L, BetweenState, OutState).
- % Find the top crates of every stack
- top_crates([], []).
- top_crates([X|Y], [A|Z]) :- nth(1, X, A), top_crates(Y, Z).
- % Solve the puzzle
- solve(TopCrates) :- findall(X, move(X, _, _, _), CounterList), start_stacks(InState), execute_move(CounterList,InState, OutState), top_crates(OutState, TopCrates).
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Swapzone Glitch ✅ Working⭐⭐⭐ L
JavaScript | 1 sec ago | 0.24 KB
-
⭐ G2A Bug ⭐ (Get more on BTC swaps) ✅ NEVER S...
JavaScript | 3 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 2
JavaScript | 12 sec ago | 0.24 KB
-
⭐✅ Jack's Profit Method ✅ NEVER SEEN BEF...
JavaScript | 13 sec ago | 0.24 KB
-
⭐✅ Jack's Profit Method ✅ NEVER SEEN BEF...
JavaScript | 19 sec ago | 0.24 KB
-
⭐⭐Exchange Exploit⭐⭐ 1
JavaScript | 23 sec ago | 0.24 KB
-
⭐✅ Online Marketplace Exploit ✅ NEVER SEEN BE...
JavaScript | 28 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ A
JavaScript | 35 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand