#loom's code
Explore tagged Tumblr posts
loomworld · 2 years ago
Note
c++ code for basic sliding tile puzzle game that the player must arrange ghe puzzle in a specific order? This is super urgent!!
LORI BABE JUS ASK ME KN DM
provides basic implementation of a sliding tile puzzle game. The puzzle board is a 2d vector and the game logic includes functions for printing the board, checking if the puzzle is solved, shuffling the board, and performing moves. The game loop allows the player to make moves until the puzzle is solved or the player quits the game.
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
using namespace std;
// Define the size of the puzzle
const int PUZZLE_SIZE = 4;
// Define the puzzle board as a 2D vector
typedef vector<vector<int>> PuzzleBoard;
// Function to print the puzzle board
void printBoard(const PuzzleBoard& board) {
for (int i = 0; i < PUZZLE_SIZE; ++i) {
for (int j = 0; j < PUZZLE_SIZE; ++j) {
cout << board[i][j] << "\t";
}
cout << endl;
}
}
// Function to check if the puzzle is solved
bool isPuzzleSolved(const PuzzleBoard& board) {
int num = 1;
for (int i = 0; i < PUZZLE_SIZE; ++i) {
for (int j = 0; j < PUZZLE_SIZE; ++j) {
if (board[i][j] != num && !(i == PUZZLE_SIZE - 1 && j == PUZZLE_SIZE - 1)) {
return false;
}
++num;
}
}
return true;
}
// Function to get the position of the blank tile (0)
pair<int, int> getBlankPosition(const PuzzleBoard& board) {
for (int i = 0; i < PUZZLE_SIZE; ++i) {
for (int j = 0; j < PUZZLE_SIZE; ++j) {
if (board[i][j] == 0) {
return make_pair(i, j);
}
}
}
return make_pair(-1, -1);
}
// Function to check if a move is valid
bool isValidMove(int row, int col) {
return (row >= 0 && row < PUZZLE_SIZE && col >= 0 && col < PUZZLE_SIZE);
}
// Function to shuffle the puzzle board
void shuffleBoard(PuzzleBoard& board) {
random_device rd;
mt19937 rng(rd());
int numShuffles = 100;
while (numShuffles > 0) {
pair<int, int> blankPos = getBlankPosition(board);
vector<pair<int, int>> possibleMoves;
// Check all possible moves
if (isValidMove(blankPos.first - 1, blankPos.second)) {
possibleMoves.push_back(make_pair(blankPos.first - 1, blankPos.second)); // Up
}
if (isValidMove(blankPos.first + 1, blankPos.second)) {
possibleMoves.push_back(make_pair(blankPos.first + 1, blankPos.second)); // Down
}
if (isValidMove(blankPos.first, blankPos.second - 1)) {
possibleMoves.push_back(make_pair(blankPos.first, blankPos.second - 1)); // Left
}
if (isValidMove(blankPos.first, blankPos.second + 1)) {
possibleMoves.push_back(make_pair(blankPos.first, blankPos.second + 1)); // Right
}
// Randomly select a move
uniform_int_distribution<int> dist(0, possibleMoves.size() - 1);
int randomMove = dist(rng);
swap(board[blankPos.first][blankPos.second], board[possibleMoves[randomMove].first][possibleMoves[randomMove].second]);
numShuffles--;
}
}
// Function to perform a move
void performMove(PuzzleBoard& board, int row, int col) {
pair<int, int> blankPos = getBlankPosition(board);
if (!isValidMove(row, col) || !isValidMove(blankPos.first, blankPos.second)) {
cout << "Invalid move!" << endl;
return;
}
// Check if the move is adjacent to the blank tile
if (!((row == blankPos.first && abs(col - blankPos.second) == 1) ||
(col == blankPos.second && abs(row - blankPos.first) == 1))) {
cout << "Invalid move!" << endl;
return;
}
swap(board[row][col], board[blankPos.first][blankPos.second]);
}
int main() {
// Initialize the puzzle board
PuzzleBoard board(PUZZLE_SIZE, vector<int>(PUZZLE_SIZE));
int num = 1;
for (int i = 0; i < PUZZLE_SIZE; ++i) {
for (int j = 0; j < PUZZLE_SIZE; ++j) {
board[i][j] = num;
++num;
}
}
board[PUZZLE_SIZE - 1][PUZZLE_SIZE - 1] = 0; // Blank tile
// Shuffle the puzzle board
shuffleBoard(board);
// Game loop
while (true) {
// Print the puzzle board
printBoard(board);
// Check if the puzzle is solved
if (isPuzzleSolved(board)) {
cout << "Congratulations! You solved the puzzle!" << endl;
break;
}
// Get the player's move
int row, col;
cout << "Enter the row and column of the tile you want to move (0 to quit): ";
cin >> row;
if (row == 0) {
break;
}
cin >> col;
// Perform the move
performMove(board, row, col);
}
return 0;
}
NOTE :
this is a simple example, and you can modify and enhance the code to suit your specific puzzle game requirements.
0 notes
ahalliance · 2 years ago
Text
interesting lore moment with the francophone yesterday (as in, it personally gave me brainworms) ft. qétoiles’ horrible, no good, stupid (lack of) self-preservation . subs in English, transcript below the cut
All spoken in French — translated into English subtitles
[Video transcript:
Etoiles: And, actually, I have a theory. Basically what happened is that I’ve just returned from a mission from Cucurucho.
Antoine: And what was the mission?
Etoiles: To do a dungeon, and to recover something from the dungeon.
Antoine: And what was this “something”?
Etoiles: And the “something” was a book that sorta says that I’m a test subject.
Antoine: A test subject?!
Baghera: What’s up with your arm? You’ve got a coded arm.
Etoiles: Uh, it’s from holding the shield, basically.
Baghera: Ahhh
(Pause)
Antoine: Watch out that it doesn’t contaminate you, or else you’ll turn into a code, man.
Etoiles: That’s impossible, man, I can’t be a code.
Antoine: That’s what the old codes said before becoming codes, you know.
Etoiles: No— well, we’ve never spoken.
Baghera: Maybe you shouldn’t be using the shield as much then, no?
Etoiles: Well, as it stands, I’ve been using it for a really long time, and my mind is still healthy, honestly. And the proof is—
Baghera: Well, half of his face took the brunt of it instead.
Etoiles: Yeah, but it’s not all there is, you know.
(Pause)
Baghera: Let me worry, Etoiles, right now.
Etoiles: You’re right. You’re right! But everything’s going well, I’m doing very, very well—
Antoine: It’s true that you look a bit sick.
Etoiles: Uh, yeah, for the past seven years, it’s a chronic illness, it happened—
Antoine: No, but not this one, the other— you seem even sicker, still.
Etoiles: Yeah, okay. Yeah but no, I’m fine. No, no, it’s fine, honestly.
End Video Transcript.]
728 notes · View notes
moeblob · 4 months ago
Text
Tumblr media
WOW it's way later than I planned to just be finishing art but here we go! I did manage!
29 notes · View notes
my-drama-heart2406 · 8 months ago
Text
It is really very concerning that for their date he wore a blue and white hanbok and she wore a pastel pink one.
The last time a couple(that I have been obsessed with for 2yrs now) wore the same colour combination and spend their day happily, things did NOT end well...
31 notes · View notes
chestersbraincell · 5 months ago
Text
Fuzzy shadow creature but I’m feeling a bit out of it recently so my fur is fucking drooping and I look like a pathetic wet beast and my white glowing eyes are like. Sad looking
9 notes · View notes
ectonurites · 1 year ago
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
ZACH TAYLOR x MODERN BASEBALL on JOSH TEMPLETON and ALLISON BANNISTER
[ BROKEN CASH MACHINE | ROCK BOTTOM | THE OLD GOSPEL CHOIR | THE WEEKEND | ALPHA KAPPA FALL OF TROY THE MOVIE PART DEUX (2 DISC DIRECTOR'S CUT) | EVERYDAY | HOURS OUTSIDE IN THE SNOW | NOTES | I THINK YOU WERE IN MY PROFILE PICTURE ONCE | HOME | REVENGE OF THE NAMELESS RANGER | INTERSECTION ]
51 notes · View notes
movedtoacolorlessworld · 1 year ago
Text
...
———
Tumblr media
.-.-.- .-.-.- .-.-.- .... . .-.. .-.. --- ..--.. -.-. .- -. ....... .- -. -.-- --- -. . ....... .... . .- .-. ....... -- . ..--.. -.-. .- -. ....... -.-- --- ..- ....... .... . .- .-. ....... -- . ..--.. .-.-.- .-.-.- .-.-.- --. --- --- -.. .-.-.- .- .-.. .-.. ....... .. ... ....... .-- . .-.. .-.. .-.-.- .... .- ...- . ....... -.-- --- ..- ....... . ...- . .-. ....... .-- --- -. -.. . .-. . -.. ....... .-- .... .- - ....... - .... . ....... .--. ..- .-. .--. --- ... . ....... --- ..-. ....... - .... . ....... .-- --- .-. .-.. -.. ....... .. ... ..--.. .-- .... -.-- ....... .-- . ....... .-.. .. ...- . ....... .. -. ....... .. - ..--.. .-- .... -.-- ....... .. - ....... .-- .- ... ....... . ...- . -. ....... -.-. .-. . .- - . -.. ....... - --- ....... -... . --. .. -. ....... .-- .. - .... ..--.. -.. --- ....... -.-- --- ..- ....... -.- -. --- .-- ....... .-- .... -.-- ....... - .... .. -. --. ... ....... .- .-. . ....... -- .- -.. . --..-- ....... .-- .... . -. ....... - .... . -.-- .----. .-.. .-.. ....... . -. -.. ....... ..- .--. ....... --. . - - .. -. --. ....... -.. . ... - .-. --- -.-- . -.. ....... .. -. ....... - .... . ....... . -. -.. ..--.. - .... .. ... ....... .-- --- .-. .-.. -.. .-.-.- .-.-.- .-.-.- .-- .. .-.. .-.. ....... . -. -.. ....... --- -. . ....... -.. .- -.-- .-.-.- .- .-.. .-.. ....... . -..- .. ... - . -. -.-. . .-.-.- .-.-.- .-.-.- .-- .. .-.. .-.. ....... . ...- . -. - ..- .- .-.. .-.. -.-- ....... -.-. . .- ... . ....... - --- ....... . -..- .. ... - .-.-.- - .... .- - ....... .. ... ....... .-- .... -.-- --..-- ....... .-- .. - .... ....... - .... . ....... .-.. .. - - .-.. . ....... - .. -- . ....... .. ....... -- .. --. .... - ....... .... .- ...- . ....... .-.. . ..-. - --..-- ....... .. ....... .-- .. .-.. .-.. ....... - .-. -.-- ....... -- -.-- ....... -... . ... - ....... - --- ....... ..-. --- .-. --. . ....... .- ....... ... - --- .-. -.-- .-.-.- .- ....... ... - --- .-. -.-- ....... - .... .- - ....... .. ... ....... ..- -. ..-. --- .-. --. . - .- -... .-.. . ....... - --- ....... .- .-.. .-.. .-.-.- .-.-.- .-.-.- .-.-.- .. ..-. ....... .-- . ....... . ...- . .-. ....... -.-. .-. --- ... ... ....... .--. .- - .... ... .-.-.- .-.-.- .-.-.- .. ..-. ....... --- ..- .-. ....... .--. .- - .... ... ....... .-- . .-. . ....... - --- ....... -.-. --- -. ...- . .-. --. . .-.-.- .-.-.- .-.-.- .--. .-.. . .- ... . --..-- ....... -.. --- ....... .-. . -- . -- -... . .-. ....... -- . .-.-.- - .... .- - ....... .. ... ....... .- .-.. .-.. .-.-.- ..- -. - .. .-.. ....... .-- . ....... -- . . - ....... ..-. --- .-. ....... .-. . .- .-.. .-.-.-
7 notes · View notes
opaleyedprince · 4 months ago
Text
dacre dungeon meshi au send tweet
2 notes · View notes
darkroomnerd · 1 year ago
Text
Tumblr media
The hand cramps are so real. It's actually affecting my ability to keep going 😞
Buuut that's another 2 hours I put into learning a language I'll need to know in less than a month. Once this chapter is done, I'll finally be able to move on to new material!
13 notes · View notes
urists · 1 year ago
Text
Sometimes I think about how badly computers and their associated innovations (read: software) broke people's brains about how technology should work. This is because making software requires, at a first pass, three things: a computer manufacturer to buy a computer from, a programmer, and some way to get the computer (plus maybe a programming book or some internet to the programmer. That's (approximately) it.
This is, to be clear, not normal. Not for things at relatively cutting edge technological activities - if you do benchwork in novel chemistry you will be ordering chemicals and labware and equipment and replacements constantly, if you want to make anything in synthetic biology you will probably need all of those things and then also living things as well that you might have to change for each project you work on - and not for technologies that are pretty normalized. If you work in manufacturing or engineering or heavy industry - or hell, fish processing - the odds are very good that any day your loading dock is not being used is a day that you do not have the critical supplies you need to accomplish your goals. There's just no way around it; even if you might be a manager who doesn't touch the product, your needs and decisions are still driven by the fact that your product is real. The technology and its connection to physical realities are inextricably linked.
And yet software companies are HUGE companies! They drive billions of dollars! It fascinates me to think about how much of the economy is built on the one modern technology that ever so lightly skims against the actual world, the one that's full of real people doing actual things. And even that skim isn't what really matters to these companies! shit's wild
4 notes · View notes
xamaxenta · 2 years ago
Note
Hhhhhngghhhh I feel u about the not wanting to go to work thing I also got someone looking over my shoulder critiquing my shit that they dont even know anything about😭 solidarity✊
😔 right? idk why cant people mind their own damn business i wish we didnt have solidarity tho that sounds rough
Especially l if this area of the company doesnt involve you
And you’re not my boss
But then MY BOSS rolls over to you so its ???? My boss is essentially fueling that their opinion is correct bc of it so its a vicious cycle and we’ve all said hey boss can u tell them to mind their business so we can get on with it but theyre chicken sooooo
Fuck us ig???
5 notes · View notes
rhinedottirau · 29 days ago
Text
I actually think the idea of Irminsul being an emperors scepter works really well because the scepters function like a system of neurons.
Or maybe I shouldn't say irminsul is an emperors scepter because irminsul and the ley lines are implied to have always been there. Rather, the modifications made to irminsul and the ley lines by the heavenly principles are the result of integrating a scepter into the equation. The modifications that stumped Kukulkan because he can't figure out how PO did it.
But like, anyway, consider neurons - if you incorporate the likely possibility that dendro was not only called dendro because trees form dendritic patterns, but because of the dendrites that are a part of the neuron structure -
Uh yeah.
Maybe there's more than one of them, maybe the moons were scepters, too, and the "lunar reconstruction" referred to in Chronicles of the Crumbling City is referring to Nibelung finding a bunch of scepters and restoring them to operational function and he used them to make the world, like shown in the Ochkanatlan mural.
0 notes
tamed-foxes · 2 months ago
Text
all the other social media apps make me want to buy useless shit but tumblr will have me wondering if I should get a loom
0 notes
caelanthe · 10 months ago
Text
Asking other devs on the team for a code review is so embarrassing... i myself dont even want to look at my code but i have to ask someone else to look over it and criticize it
And then they look at it and find all these dumb things i wrote and mistakes i made and its like yup. Im a dumbass. Thanks. Gonna fix them now.
1 note · View note
whetstonefires · 2 years ago
Text
when i was a kid i made up a society where they tracked birth sex for reproductive reasons but it didn't particularly determine adult gender, because that was tied to your job--like at some point they got so attached to gender roles that they decided the performance of a role determined the gender. (which historically has been the case quite often, just not to this extent lol.)
it was in the context of a badly written short story where an anthropologist had just straight up failed to grasp that this was how it worked for a humorously long time.
If somebody pitched me traditional gender roles for the first time they would have me in the first half not going to lie.
Oh, in a complex society with a massive amount of required knowledge and responsibilities, two people traditionally partner together so that the knowledge and responsibilities can be divided between them? Awesome!
Wait what do you mean the responsibilities are assigned at birth.
WHAT DO YOU MEAN ONE HALF HAS FEWER CIVIL RIGHTS.
17K notes · View notes
onecooooooolcat · 1 year ago
Text
hmm what new thing am i going to learn this year just realized i havent thought abt it.
1 note · View note