From bc0509be44da03fc6da5d2fe1ca69c759dbe6eee Mon Sep 17 00:00:00 2001 From: Pedro Lopes Date: Mon, 17 Oct 2022 22:09:36 -0300 Subject: [PATCH] Adiciona gabarito - TP02Q08 --- .../Game_Linux.c | 859 ++++++++++++++++++ .../TP02Q08 - Lista sequencial em C/WSL_Game | Bin 0 -> 26208 bytes .../WSL_Game.c | 858 +++++++++++++++++ .../TP02Q08 - Lista sequencial em C/pub.in | 72 ++ .../TP02Q08 - Lista sequencial em C/pub.out | 61 ++ .../TP02Q08 - Lista sequencial em C/saida.out | 61 ++ 6 files changed, 1911 insertions(+) create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/Game_Linux.c create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game.c create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.in create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.out create mode 100644 tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/saida.out diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/Game_Linux.c b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/Game_Linux.c new file mode 100644 index 0000000..8554cb3 --- /dev/null +++ b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/Game_Linux.c @@ -0,0 +1,859 @@ +// -------------------------------------------------------------------------------- // + +// Includes +#include +#include +#include +#include +#include + +// -------------------------------------------------------------------------------- // + +// Definitions +#define MAX_GAMES 500 +#define MAX_FIELD_SIZE 250 +#define MAX_STRING_ARRAY_SIZE 100 + +// -------------------------------------------------------------------------------- // + +// Structs +typedef struct { + + int year, + month; +} Date; + +typedef struct { + + char name[MAX_FIELD_SIZE], + owners[MAX_FIELD_SIZE], + website[MAX_FIELD_SIZE], + developers[MAX_FIELD_SIZE], + languages[MAX_STRING_ARRAY_SIZE][30], + genres[MAX_STRING_ARRAY_SIZE][30]; + + Date release_date; + int app_id, age, dlcs, avg_playtime, count_languages, count_genres; + float price, upvotes; + bool windows_os, mac_os, linux_os; + +} Game; + +// -------------------------------------------------------------------------------- // + +// Global variables +Game games[MAX_GAMES]; +int n = 0; + +Game gamesFull[5000]; +int x = 0; + +// -------------------------------------------------------------------------------- // + +// Functions +bool isFim(char* s) { return s[0] == 'F' && s[1] == 'I' && s[2] == 'M'; } + +void substring(char *string, char *string_start, int length) { + + strncpy(string, string_start, length); + string[length] = '\0'; +} + +char *getMonthName(int month) { + + switch(month) { + + case 1: return "Jan"; break; + case 2: return "Feb"; break; + case 3: return "Mar"; break; + case 4: return "Apr"; break; + case 5: return "May"; break; + case 6: return "Jun"; break; + case 7: return "Jul"; break; + case 8: return "Aug"; break; + case 9: return "Sep"; break; + case 10: return "Oct"; break; + case 11: return "Nov"; break; + case 12: return "Dec"; break; + + default: return "N/A"; break; + } +} + +int getMonthNumber(char* month) { + + if(!strcmp(month, "Jan")) return 1; + else if(!strcmp(month, "Feb")) return 2; + else if(!strcmp(month, "Mar")) return 3; + else if(!strcmp(month, "Apr")) return 4; + else if(!strcmp(month, "May")) return 5; + else if(!strcmp(month, "Jun")) return 6; + else if(!strcmp(month, "Jul")) return 7; + else if(!strcmp(month, "Aug")) return 8; + else if(!strcmp(month, "Sep")) return 9; + else if(!strcmp(month, "Oct")) return 10; + else if(!strcmp(month, "Nov")) return 11; + else if(!strcmp(month, "Dec")) return 12; +} + +// -------------------------------------------------------------------------------- // + +// Class game functions +void game_start(Game *game) { + + strcpy(game -> name, ""); + strcpy(game -> owners, ""); + strcpy(game -> website, ""); + strcpy(game -> developers, ""); + + for(int i = 0; i < MAX_STRING_ARRAY_SIZE; i++) { + + strcpy(game -> languages[i], ""); + strcpy(game -> genres[i], ""); + } + + game -> release_date.month = -1; + game -> release_date.year = -1; + game -> app_id = -1; + game -> age = -1; + game -> dlcs = -1; + game -> avg_playtime = -1; + game -> price = -1; + game -> upvotes = -1; + game -> windows_os = false; + game -> mac_os = false; + game -> linux_os = false; + + game -> count_languages = 0; + game -> count_genres = 0; +} + +void game_print(Game *game) { + + int hours = game -> avg_playtime / 60, + minutes = game -> avg_playtime % 60; + + printf("%i %s %s/%04i %s %i %.2f %i [", game -> app_id, game -> name, getMonthName(game -> release_date.month), game -> release_date.year, game -> owners, game -> age, game -> price, game -> dlcs); + + for(int i = 0; i < game -> count_languages; i++) { + + printf("%s%s", game -> languages[i], i < game -> count_languages - 1 ? ", " : ""); + } + + printf("] %s %s %s %s ", game -> website, game -> windows_os ? "true" : "false", game -> mac_os ? "true" : "false", game -> linux_os ? "true" : "false"); + + if(isnan(game -> upvotes)) printf("0.0%% "); + else printf("%.0f%% ", game -> upvotes); + + if(hours > 0) + { + printf("%ih ", hours); + + if(minutes > 0) printf("%im ", minutes); + } + else { + + if(minutes > 0) printf("%im ", minutes); + else printf("null "); + } + + printf("%s [", game -> developers); + + for(int i = 0; i < game -> count_genres; i++) { + + printf("%s%s", game -> genres[i], i < game -> count_genres - 1 ? ", " : ""); + } + + printf("]\n"); +} + +Game game_clone(Game *game) { + + Game cloned; + + strcpy(cloned.name, game -> name); + strcpy(cloned.owners, game -> owners); + strcpy(cloned.website, game -> website); + strcpy(cloned.developers, game -> developers); + + for(int i = 0; i < game -> count_languages; i++) strcpy(cloned.languages[i], game -> languages[i]); + for(int i = 0; i < game -> count_genres; i++) strcpy(cloned.genres[i], game -> genres[i]); + + cloned.release_date.month = game -> release_date.month; + cloned.release_date.year = game -> release_date.year; + cloned.app_id = game -> app_id; + cloned.age = game -> age; + cloned.dlcs = game -> dlcs; + cloned.avg_playtime = game -> avg_playtime; + cloned.price = game -> price; + cloned.upvotes = game -> upvotes; + cloned.windows_os = game -> windows_os; + cloned.mac_os = game -> mac_os; + cloned.linux_os = game -> linux_os; + return cloned; +} + +void game_read(Game *game, char *line) { + + char c_search, sub[MAX_FIELD_SIZE]; + int index = 0, atr_index = 0; + + // ------------------------------------------------------------ // + + // Find "AppID" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> app_id = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Name" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> name, sub); + + if(c_search == ',') index++; + else if(c_search == '\"') index += 2; + + atr_index = index; + break; + } + } + } + else { + + strcpy(game -> name, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find release date + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + + char subDate[10]; + + substring(subDate, &sub[0], 3); + + game -> release_date.month = getMonthNumber(subDate); + + if(c_search == ',') { + + substring(subDate, &sub[4], 4); + + game -> release_date.year = atoi(subDate); + + index++; + } + else if(c_search == '\"') { + + int nmbSpace = 0; + + for(int i = 0; ; i++) { + + if(sub[i] == ' ') nmbSpace++; + + if(nmbSpace == 2) { + + i++; + + substring(subDate, &sub[i], 4); + + game -> release_date.year = atoi(subDate); + break; + } + } + + index += 2; + } + + atr_index = index; + break; + } + } + } + else { + + game -> release_date.month = 0; + game -> release_date.year = 0; + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Owners" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> owners, sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Age" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> age = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Price" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> price = atof(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "DLCs" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> dlcs = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Languages" + while(true) { + + index++; + + if(line[index] == ']') { + + index++; + + if(line[index] == ',') index++; + else if(line[index] == '\"') index += 2; + + atr_index = index; + break; + } + else if(line[index] == '\'') { + + int wordStart = index + 1; + + while(true) { + + index++; + + if(line[index] == '\'') { + + substring(sub, &line[wordStart], index - wordStart); + strcpy(game -> languages[game -> count_languages++], sub); + break; + } + } + } + } + + // ------------------------------------------------------------ // + + // Find "Website" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> website, sub); + + atr_index = ++index; + break; + } + } + } + else { + + strcpy(game -> website, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Windows" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> windows_os = true; + + atr_index = ++index; + break; + } + } + + // Find "Mac" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> mac_os = true; + + atr_index = ++index; + break; + } + } + + // Find "Linux" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> linux_os = true; + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Upvotes" + int positives, negatives; + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + positives = atoi(sub); + atr_index = ++index; + break; + } + } + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + negatives = atoi(sub); + atr_index = ++index; + break; + } + } + + game -> upvotes = (float)(positives * 100) / (float)(positives + negatives); + + // ------------------------------------------------------------ // + + // Find "AVG Playtime" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> avg_playtime = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Developers" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> developers, sub); + + atr_index = ++index; + break; + } + } + } + else { + + strcpy(game -> developers, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Genres" + if(index < strlen(line) - 1) { + + if(line[index] == ',') atr_index = ++index; + + if(line[atr_index] == '\"') { + + atr_index++; + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> genres[game -> count_genres++], sub); + + atr_index = ++index; + } + else if(line[index] == '\"') { + + substring(sub, &line[atr_index], strlen(line) - 1 - atr_index); + + if(sub[strlen(sub) - 2] == '\"') sub[strlen(sub) - 2] = '\0'; + + strcpy(game -> genres[game -> count_genres++], sub); + break; + } + } + } + else { + + substring(sub, &line[atr_index], strlen(line) - 1 - atr_index); + + sub[strlen(line) - 2 - atr_index] = '\0'; + + strcpy(game -> genres[game -> count_genres++], sub); + } + } +} + +// -------------------------------------------------------------------------------- // + +// Functions - List +void list_insertBegin(Game x) { + + if(n >= MAX_GAMES) { + + printf("Insert error: MAX_GAMES reached"); + exit(1); + } + + for(int i = n; i > 0; i--) games[i] = games[i - 1]; + + games[0] = x; + n++; +} + +void list_insertEnd(Game x) { + + if(n >= MAX_GAMES) { + + printf("Insert error: MAX_GAMES reached"); + exit(1); + } + + games[n++] = x; +} + +void list_insert(Game x, int pos) { + + if(n >= MAX_GAMES || (pos < 0 || pos > n)) { + + printf("Insert error: %s", n >= MAX_GAMES ? "MAX_GAMES reached" : "Invalid position"); + exit(1); + } + + for(int i = n; i > pos; i--) games[i] = games[i-1]; + + games[pos] = x; + n++; +} + +Game list_removeBegin() { + + Game resp; + + if(n == 0) { + + printf("Remove error: Empty list"); + exit(1); + } + + resp = games[0]; + n--; + + for(int i = 0; i < n; i++) games[i] = games[i + 1]; + return resp; +} + +Game list_removeEnd() { + + if(n == 0) { + + printf("Remove error: Empty list"); + exit(1); + } + return games[--n]; +} + +Game list_remove(int pos) { + + Game resp; + + if(n >= MAX_GAMES || (pos < 0 || pos > n)) { + + printf("Insert error: %s!", n == 0 ? "Empty list" : "Invalid position"); + exit(1); + } + + resp = games[pos]; + n--; + + for(int i = pos; i < n; i++) games[i] = games[i+1]; + return resp; +} + +void list_print() { + + for(int i = 0; i < n; i++) { + + printf("[%i] ", i); + game_print(&games[i]); + } +} + +Game game_search(int app_id) { + + for(int i = 0; i < x; i++) { + + if(gamesFull[i].app_id == app_id) return gamesFull[i]; + } + + Game game; + game.app_id = -1; + return game; +} + +// ---------------------------------------------------------------------------------------------------------- // + +int main() { + + // ---------------------------------------------------------------------------------------- // + + // Fill full games list + FILE *fp; + char *line = NULL; + size_t len = 0; + size_t read; + + fp = fopen("/tmp/games.csv", "r"); + + if(fp == NULL) exit(EXIT_FAILURE); + + // -------------------------------------- // + + while((read = getline(&line, &len, fp)) != -1) { + + Game game; + + game_start(&game); + game_read(&game, line); + + gamesFull[x++] = game; + } + + fclose(fp); + + if(line) free(line); + + // ---------------------------------------------------------------------------------------- // + + char line_in[100]; + + // Fill production games list + scanf(" %[^\n]", line_in); + + while(true) { + + if(isFim(line_in)) break; + + // -------------------------- // + + int app_id = atoi(line_in); + + Game found = game_search(app_id); + + if(found.app_id != -1) list_insertEnd(found); + + // -------------------------- // + + scanf(" %[^\n]", line_in); + } + + // ---------------------------------------------------------------------------------------- // + + // Execute operations + int n_ops; + scanf("%i", &n_ops); + + for(int i = 0; i < n_ops; i++) { + + scanf(" %[^\n]", line_in); + + Game game; + char params[10]; + + if(line_in[0] == 'I') { + + substring(params, &line_in[3], strlen(line_in) - 3); + + if(line_in[1] == 'I') list_insertBegin(game_search(atoi(params))); + else if(line_in[1] == 'F') list_insertEnd(game_search(atoi(params))); + else if(line_in[1] == '*') { + + char appId[10], pos[10]; + int i = 0; + + while(true) { + + if(params[i] == ' ') { + + substring(pos, ¶ms[0], i); + substring(appId, ¶ms[i + 1], strlen(params) - i - 1); + break; + } + else i++; + } + + list_insert(game_search(atoi(appId)), atoi(pos)); + } + } + else if(line_in[0] == 'R') { + + if(line_in[1] == 'I') printf("(R) %s\n", list_removeBegin().name); + else if(line_in[1] == 'F') printf("(R) %s\n", list_removeEnd().name); + else if(line_in[1] == '*') { + + substring(params, &line_in[3], strlen(line_in) - 3); + + printf("(R) %s\n", list_remove(atoi(params)).name); + } + } + } + + list_print(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game new file mode 100644 index 0000000000000000000000000000000000000000..498668a2dc5c58a68382de1586ba84632d2316f2 GIT binary patch literal 26208 zcmeHQ3w%_?xu4Cl5D~ILNyYcdC6#9g2nY%_0XCdiUh+_s#}bl-tmb91i-7_L*R@%f zEvZ*p{MDZqf4yyOtF5-xVk_4~ki=fpfT&ohMyt2G4QdQ}8xY<5|K@S_oReM97QOx5 z%h9vn%=em^Z@&4?oSBp1cK7U}44aLq%g(;RDCasyUK>S|HE@6F< z@56C|ULXLd;yRRJhM5v?2PC;6lt=+D5@@ENsv$v=OLr|fOHdSK*&brPEs=6dq@03X(hv$N zdy-A)o-FNYg)Y$Oa`9irta3}FoE6TL{0dSTbS-?>U-tKuH($zaFBE#LaF0MU1yy<1 zL5}S5c`wz?3uJle`eCQ+2L+{h+1Lu-s!0>ZR+N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O}c~#YZZ{C`! zKweEPPWG+!uQQ-l1$;QB+E*q~h0}}2_)FF>&R$+pSI+Xv)>WYh0sXatvesK$N4uMx zO=dix)p{#RNI<4)D*P;u_e&mU}fb;y`dSofQfV-Lxi9Bz)3@GJg(57-i zhlngfLZwkuNu>|UggAPZ!UqeoU3bC870=*V_O0TjX6*PC>3*sw7}h&wgT+ zm+KEM2^GImq4EkoYLQp#7YcSMK?#+df=^oH)jU+emz4upB>Ao?U#N1;m& z3tgY;|DS_KEJ|Lj6KV5EN`43_lKfYdt6*OU8|B$b$vj^`RgT2!<*Ph>vq8F4`L30M zk}c(3!_DtYE`q2xzd@We}(5h~vi6!BXi%h%+>Ilb=EtC(uHioZlw ibr+K2xA8^+Kd}&1xr&#DxrK$3g3ATR1r`BImi-TTDC_|M literal 0 HcmV?d00001 diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game.c b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game.c new file mode 100644 index 0000000..e85add2 --- /dev/null +++ b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/WSL_Game.c @@ -0,0 +1,858 @@ +// -------------------------------------------------------------------------------- // + +// Includes +#include +#include +#include +#include +#include + +// -------------------------------------------------------------------------------- // + +// Definitions +#define MAX_GAMES 500 +#define MAX_FIELD_SIZE 250 +#define MAX_STRING_ARRAY_SIZE 100 + +// -------------------------------------------------------------------------------- // + +// Structs +typedef struct { + + int year, + month; +} Date; + +typedef struct { + + char name[MAX_FIELD_SIZE], + owners[MAX_FIELD_SIZE], + website[MAX_FIELD_SIZE], + developers[MAX_FIELD_SIZE], + languages[MAX_STRING_ARRAY_SIZE][30], + genres[MAX_STRING_ARRAY_SIZE][30]; + + Date release_date; + int app_id, age, dlcs, avg_playtime, count_languages, count_genres; + float price, upvotes; + bool windows_os, mac_os, linux_os; + +} Game; + +// -------------------------------------------------------------------------------- // + +// Global variables +Game games[MAX_GAMES]; +int n = 0; + +Game gamesFull[5000]; +int x = 0; + +// -------------------------------------------------------------------------------- // + +// Functions +bool isFim(char* s) { return s[0] == 'F' && s[1] == 'I' && s[2] == 'M'; } + +void substring(char *string, char *string_start, int length) { + + strncpy(string, string_start, length); + string[length] = '\0'; +} + +char *getMonthName(int month) { + + switch(month) { + + case 1: return "Jan"; break; + case 2: return "Feb"; break; + case 3: return "Mar"; break; + case 4: return "Apr"; break; + case 5: return "May"; break; + case 6: return "Jun"; break; + case 7: return "Jul"; break; + case 8: return "Aug"; break; + case 9: return "Sep"; break; + case 10: return "Oct"; break; + case 11: return "Nov"; break; + case 12: return "Dec"; break; + + default: return "N/A"; break; + } +} + +int getMonthNumber(char* month) { + + if(!strcmp(month, "Jan")) return 1; + else if(!strcmp(month, "Feb")) return 2; + else if(!strcmp(month, "Mar")) return 3; + else if(!strcmp(month, "Apr")) return 4; + else if(!strcmp(month, "May")) return 5; + else if(!strcmp(month, "Jun")) return 6; + else if(!strcmp(month, "Jul")) return 7; + else if(!strcmp(month, "Aug")) return 8; + else if(!strcmp(month, "Sep")) return 9; + else if(!strcmp(month, "Oct")) return 10; + else if(!strcmp(month, "Nov")) return 11; + else if(!strcmp(month, "Dec")) return 12; +} + +// -------------------------------------------------------------------------------- // + +// Class game functions +void game_start(Game *game) { + + strcpy(game -> name, ""); + strcpy(game -> owners, ""); + strcpy(game -> website, ""); + strcpy(game -> developers, ""); + + for(int i = 0; i < MAX_STRING_ARRAY_SIZE; i++) { + + strcpy(game -> languages[i], ""); + strcpy(game -> genres[i], ""); + } + + game -> release_date.month = -1; + game -> release_date.year = -1; + game -> app_id = -1; + game -> age = -1; + game -> dlcs = -1; + game -> avg_playtime = -1; + game -> price = -1; + game -> upvotes = -1; + game -> windows_os = false; + game -> mac_os = false; + game -> linux_os = false; + + game -> count_languages = 0; + game -> count_genres = 0; +} + +void game_print(Game *game) { + + int hours = game -> avg_playtime / 60, + minutes = game -> avg_playtime % 60; + + printf("%i %s %s/%04i %s %i %.2f %i [", game -> app_id, game -> name, getMonthName(game -> release_date.month), game -> release_date.year, game -> owners, game -> age, game -> price, game -> dlcs); + + for(int i = 0; i < game -> count_languages; i++) { + + printf("%s%s", game -> languages[i], i < game -> count_languages - 1 ? ", " : ""); + } + + printf("] %s %s %s %s ", game -> website, game -> windows_os ? "true" : "false", game -> mac_os ? "true" : "false", game -> linux_os ? "true" : "false"); + + if(isnan(game -> upvotes)) printf("0.0%% "); + else printf("%.0f%% ", game -> upvotes); + + if(hours > 0) + { + printf("%ih ", hours); + + if(minutes > 0) printf("%im ", minutes); + } + else { + + if(minutes > 0) printf("%im ", minutes); + else printf("null "); + } + + printf("%s [", game -> developers); + + for(int i = 0; i < game -> count_genres; i++) { + + printf("%s%s", game -> genres[i], i < game -> count_genres - 1 ? ", " : ""); + } + + printf("]\n"); +} + +Game game_clone(Game *game) { + + Game cloned; + + strcpy(cloned.name, game -> name); + strcpy(cloned.owners, game -> owners); + strcpy(cloned.website, game -> website); + strcpy(cloned.developers, game -> developers); + + for(int i = 0; i < game -> count_languages; i++) strcpy(cloned.languages[i], game -> languages[i]); + for(int i = 0; i < game -> count_genres; i++) strcpy(cloned.genres[i], game -> genres[i]); + + cloned.release_date.month = game -> release_date.month; + cloned.release_date.year = game -> release_date.year; + cloned.app_id = game -> app_id; + cloned.age = game -> age; + cloned.dlcs = game -> dlcs; + cloned.avg_playtime = game -> avg_playtime; + cloned.price = game -> price; + cloned.upvotes = game -> upvotes; + cloned.windows_os = game -> windows_os; + cloned.mac_os = game -> mac_os; + cloned.linux_os = game -> linux_os; + return cloned; +} + +void game_read(Game *game, char *line) { + + char c_search, sub[MAX_FIELD_SIZE]; + int index = 0, atr_index = 0; + + // ------------------------------------------------------------ // + + // Find "AppID" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> app_id = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Name" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> name, sub); + + if(c_search == ',') index++; + else if(c_search == '\"') index += 2; + + atr_index = index; + break; + } + } + } + else { + + strcpy(game -> name, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find release date + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + + char subDate[10]; + + substring(subDate, &sub[0], 3); + + game -> release_date.month = getMonthNumber(subDate); + + if(c_search == ',') { + + substring(subDate, &sub[4], 4); + + game -> release_date.year = atoi(subDate); + + index++; + } + else if(c_search == '\"') { + + int nmbSpace = 0; + + for(int i = 0; ; i++) { + + if(sub[i] == ' ') nmbSpace++; + + if(nmbSpace == 2) { + + i++; + + substring(subDate, &sub[i], 4); + + game -> release_date.year = atoi(subDate); + break; + } + } + + index += 2; + } + + atr_index = index; + break; + } + } + } + else { + + game -> release_date.month = 0; + game -> release_date.year = 0; + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Owners" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> owners, sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Age" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> age = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Price" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> price = atof(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "DLCs" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> dlcs = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Languages" + while(true) { + + index++; + + if(line[index] == ']') { + + index++; + + if(line[index] == ',') index++; + else if(line[index] == '\"') index += 2; + + atr_index = index; + break; + } + else if(line[index] == '\'') { + + int wordStart = index + 1; + + while(true) { + + index++; + + if(line[index] == '\'') { + + substring(sub, &line[wordStart], index - wordStart); + strcpy(game -> languages[game -> count_languages++], sub); + break; + } + } + } + } + + // ------------------------------------------------------------ // + + // Find "Website" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> website, sub); + + atr_index = ++index; + break; + } + } + } + else { + + strcpy(game -> website, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Windows" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> windows_os = true; + + atr_index = ++index; + break; + } + } + + // Find "Mac" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> mac_os = true; + + atr_index = ++index; + break; + } + } + + // Find "Linux" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + if(!strcmp(sub, "True")) game -> linux_os = true; + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Upvotes" + int positives, negatives; + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + positives = atoi(sub); + atr_index = ++index; + break; + } + } + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + negatives = atoi(sub); + atr_index = ++index; + break; + } + } + + game -> upvotes = (float)(positives * 100) / (float)(positives + negatives); + + // ------------------------------------------------------------ // + + // Find "AVG Playtime" + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + + game -> avg_playtime = atoi(sub); + + atr_index = ++index; + break; + } + } + + // ------------------------------------------------------------ // + + // Find "Developers" + if(line[atr_index] != ',') { + + if(line[atr_index] == '\"') { + + atr_index++; + c_search = '\"'; + } + else c_search = ','; + + while(true) { + + index++; + + if(line[index] == c_search) { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> developers, sub); + + atr_index = ++index; + break; + } + } + } + else { + + strcpy(game -> developers, "null"); + + atr_index = ++index; + } + + // ------------------------------------------------------------ // + + // Find "Genres" + if(index < strlen(line) - 1) { + + if(line[index] == ',') atr_index = ++index; + + if(line[atr_index] == '\"') { + + atr_index++; + + while(true) { + + index++; + + if(line[index] == ',') { + + substring(sub, &line[atr_index], index - atr_index); + strcpy(game -> genres[game -> count_genres++], sub); + + atr_index = ++index; + } + else if(line[index] == '\"') { + + substring(sub, &line[atr_index], strlen(line) - 1 - atr_index); + + if(sub[strlen(sub) - 1] == '\"') sub[strlen(sub) - 1] = '\0'; + else if(sub[strlen(sub) - 2] == '\"') sub[strlen(sub) - 2] = '\0'; + + strcpy(game -> genres[game -> count_genres++], sub); + break; + } + } + } + else { + + substring(sub, &line[atr_index], strlen(line) - 1 - atr_index); + + strcpy(game -> genres[game -> count_genres++], sub); + } + } +} + +// -------------------------------------------------------------------------------- // + +// Functions - List +void list_insertBegin(Game x) { + + if(n >= MAX_GAMES) { + + printf("Insert error: MAX_GAMES reached"); + exit(1); + } + + for(int i = n; i > 0; i--) games[i] = games[i - 1]; + + games[0] = x; + n++; +} + +void list_insertEnd(Game x) { + + if(n >= MAX_GAMES) { + + printf("Insert error: MAX_GAMES reached"); + exit(1); + } + + games[n++] = x; +} + +void list_insert(Game x, int pos) { + + if(n >= MAX_GAMES || (pos < 0 || pos > n)) { + + printf("Insert error: %s", n >= MAX_GAMES ? "MAX_GAMES reached" : "Invalid position"); + exit(1); + } + + for(int i = n; i > pos; i--) games[i] = games[i-1]; + + games[pos] = x; + n++; +} + +Game list_removeBegin() { + + Game resp; + + if(n == 0) { + + printf("Remove error: Empty list"); + exit(1); + } + + resp = games[0]; + n--; + + for(int i = 0; i < n; i++) games[i] = games[i + 1]; + return resp; +} + +Game list_removeEnd() { + + if(n == 0) { + + printf("Remove error: Empty list"); + exit(1); + } + return games[--n]; +} + +Game list_remove(int pos) { + + Game resp; + + if(n >= MAX_GAMES || (pos < 0 || pos > n)) { + + printf("Insert error: %s!", n == 0 ? "Empty list" : "Invalid position"); + exit(1); + } + + resp = games[pos]; + n--; + + for(int i = pos; i < n; i++) games[i] = games[i+1]; + return resp; +} + +void list_print() { + + for(int i = 0; i < n; i++) { + + printf("[%i] ", i); + game_print(&games[i]); + } +} + +Game game_search(int app_id) { + + for(int i = 0; i < x; i++) { + + if(gamesFull[i].app_id == app_id) return gamesFull[i]; + } + + Game game; + game.app_id = -1; + return game; +} + +// ---------------------------------------------------------------------------------------------------------- // + +int main() { + + // ---------------------------------------------------------------------------------------- // + + // Fill full games list + FILE *fp; + char *line = NULL; + size_t len = 0; + size_t read; + + fp = fopen("/tmp/games.csv", "r"); + + if(fp == NULL) exit(EXIT_FAILURE); + + // -------------------------------------- // + + while((read = getline(&line, &len, fp)) != -1) { + + Game game; + + game_start(&game); + game_read(&game, line); + + gamesFull[x++] = game; + } + + fclose(fp); + + if(line) free(line); + + // ---------------------------------------------------------------------------------------- // + + char line_in[100]; + + // Fill production games list + scanf(" %[^\n]", line_in); + + while(true) { + + if(isFim(line_in)) break; + + // -------------------------- // + + int app_id = atoi(line_in); + + Game found = game_search(app_id); + + if(found.app_id != -1) list_insertEnd(found); + + // -------------------------- // + + scanf(" %[^\n]", line_in); + } + + // ---------------------------------------------------------------------------------------- // + + // Execute operations + int n_ops; + scanf("%i", &n_ops); + + for(int i = 0; i < n_ops; i++) { + + scanf(" %[^\n]", line_in); + + Game game; + char params[10]; + + if(line_in[0] == 'I') { + + substring(params, &line_in[3], strlen(line_in) - 3); + + if(line_in[1] == 'I') list_insertBegin(game_search(atoi(params))); + else if(line_in[1] == 'F') list_insertEnd(game_search(atoi(params))); + else if(line_in[1] == '*') { + + char appId[10], pos[10]; + int i = 0; + + while(true) { + + if(params[i] == ' ') { + + substring(pos, ¶ms[0], i); + substring(appId, ¶ms[i + 1], strlen(params) - i - 1); + break; + } + else i++; + } + + list_insert(game_search(atoi(appId)), atoi(pos)); + } + } + else if(line_in[0] == 'R') { + + if(line_in[1] == 'I') printf("(R) %s\n", list_removeBegin().name); + else if(line_in[1] == 'F') printf("(R) %s\n", list_removeEnd().name); + else if(line_in[1] == '*') { + + substring(params, &line_in[3], strlen(line_in) - 3); + + printf("(R) %s\n", list_remove(atoi(params)).name); + } + } + } + + list_print(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.in b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.in new file mode 100644 index 0000000..90b8669 --- /dev/null +++ b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.in @@ -0,0 +1,72 @@ +1189490 +300550 +49800 +1851280 +1112930 +275570 +1276550 +1096530 +690510 +1504570 +1369470 +270130 +336150 +573210 +886470 +1368820 +951530 +247370 +1879330 +1634290 +259570 +941650 +768450 +1347140 +722670 +711540 +450170 +730 +598550 +614090 +809440 +1923860 +559010 +1547380 +554310 +1124090 +292120 +691930 +325420 +663670 +503820 +49600 +49300 +1631930 +1038740 +336760 +64000 +487580 +410890 +363110 +FIM +20 +II 1487390 +II 258520 +II 1165270 +II 298140 +II 213610 +IF 50510 +IF 998660 +IF 1740720 +I* 10 24720 +I* 15 439550 +I* 20 1507410 +RF +RF +RF +RI +RI +R* 10 +RF +RF +RI \ No newline at end of file diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.out b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.out new file mode 100644 index 0000000..e8bb1a6 --- /dev/null +++ b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/pub.out @@ -0,0 +1,61 @@ +(R) Have a Nice Death +(R) Sopwith VR +(R) Burn Zombie Burn! +(R) Sonic Adventure 2 +(R) Rhiannon: Curse of the Four Branches +(R) Faefever +(R) NOBUNAGA'S AMBITION: Tendou with Power Up Kit +(R) Higurashi When They Cry Hou - Ch.2 Watanagashi +(R) Synthesis Universe -Episode 00- +[0] 258520 The Vanishing of Ethan Carter Sep/2014 500000 - 1000000 0 19.99 2 [English, French, Italian, German, Spanish - Spain, Polish, Czech] http://EthanCarterGame.com true false false 89% 3h 13m The Astronauts [Adventure, Indie] +[1] 1487390 ANVIL Dec/2021 50000 - 100000 0 24.99 0 [English, Korean, German, Russian, Japanese, Simplified Chinese, Traditional Chinese, French, Polish, Portuguese - Brazil, Spanish - Latin America, Italian, Thai, Vietnamese] https://www.anvil.world/ true false false 63% 9h 51m Action Square [Action, Early Access] +[2] 1189490 觅长生 Nov/2019 500000 - 1000000 0 11.99 0 [Simplified Chinese] null true false false 91% 33h 39m Chalcedony Network [Indie, RPG, Strategy, Early Access] +[3] 300550 Shadowrun: Dragonfall - Director's Cut Sep/2014 500000 - 1000000 0 14.99 0 [English] http://harebrained-schemes.com/shadowrun/dragonfall/ true true true 89% 15h 1m Harebrained Schemes [Adventure, Indie, RPG, Strategy] +[4] 49800 Flight of the Icarus May/2010 50000 - 100000 0 4.99 0 [English] http://musegames.com/games/flight-of-the-icarus/ true true false 39% 15m Muse Games [Action, Indie] +[5] 1851280 Samurai Bringer Apr/2022 50000 - 100000 0 9.99 0 [English, Japanese, Simplified Chinese, Traditional Chinese] https://playism.com/game/samurai-bringer/ true false false 88% 5h 2m ALPHAWING Inc. [Action, Indie] +[6] 1112930 Dredgers Oct/2019 50000 - 100000 0 11.99 0 [English, Simplified Chinese] null true false false 92% null Pirate-Rob [Indie, RPG] +[7] 24720 SPORE™ Galactic Adventures Jun/2009 500000 - 1000000 0 19.99 0 [English, French, German, Italian, Spanish - Spain, Dutch, Russian, Polish, Czech, Hungarian, Finnish, Norwegian, Swedish, Danish] http://www.spore.com/what/ga true false false 88% 15h 32m EA - Maxis [Action, Simulation] +[8] 275570 Summoner Mar/2014 50000 - 100000 0 4.99 0 [English, German] null true false false 83% 3h 24m Volition [Action, RPG] +[9] 1096530 Solasta: Crown of the Magister May/2021 500000 - 1000000 0 15.99 4 [English, French, German, Simplified Chinese, Portuguese - Brazil, Russian] https://www.solasta-game.com/ true true false 89% 37h 56m Tactical Adventures [Adventure, RPG, Strategy] +[10] 690510 Immortal Soul: Black Survival Mar/2019 500000 - 1000000 0 0.00 0 [English, Japanese, Korean, French, Italian, German, Spanish - Spain, Russian, Simplified Chinese, Traditional Chinese, Thai, Portuguese, Portuguese - Brazil] null true false false 79% 28h 5m Nimble Neuron [Free to Play, Indie, Strategy] +[11] 439550 'n Verlore Verstand Apr/2016 50000 - 100000 0 14.99 1 [English, French, Italian, German, Spanish - Spain, Arabic, Bulgarian, Czech, Danish, Dutch, Finnish, Greek, Hungarian, Japanese, Korean, Norwegian, Polish, Portuguese, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Swedish, Thai, Traditional Chinese, Turkish, Ukrainian] http://www.skobbejakgames.com true true true 39% 2h 20m Skobbejak Games,Skermunkel [Adventure, Casual, Indie] +[12] 1504570 Cultivation Tales Apr/2022 500000 - 1000000 0 19.99 0 [English, Simplified Chinese] null true false false 38% 27h 42m Ac Games [Action, Adventure, Indie, RPG, Strategy, Early Access] +[13] 1369470 Pincremental Aug/2020 50000 - 100000 0 0.00 0 [English] null true true false 80% null Makopaz [Casual, Free to Play, Indie, Simulation, Strategy] +[14] 270130 The Gallery - Episode 1: Call of the Starseed Apr/2016 50000 - 100000 0 14.99 1 [English] http://www.cloudheadgames.com true false false 84% 36m Cloudhead Games ltd. [Adventure, Casual, Indie] +[15] 336150 Virtual Pool 4 May/2015 50000 - 100000 0 24.99 0 [English] http://vponline.celeris.com true false false 83% null Celeris [Sports] +[16] 1507410 Coloring Book for Kids Mar/2021 50000 - 100000 0 0.00 1 [English, French, Italian, German, Arabic, Czech, Danish, Dutch, Hungarian, Japanese, Korean, Norwegian, Polish, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Spanish - Latin America, Swedish, Thai, Turkish, Vietnamese] null true true false 89% null Peaksel [Casual, Free to Play, Indie] +[17] 573210 Mistwood Heroes Dec/2016 50000 - 100000 0 3.99 0 [English] null true false false 56% 4h Meepower [Action, Adventure, Casual, Indie, RPG] +[18] 886470 Another Otter Jul/2018 50000 - 100000 0 0.99 0 [English] null true false false 63% null PepoLab [Casual, Indie] +[19] 1368820 RollerCoaster Tycoon® 3: Complete Edition Sep/2020 50000 - 100000 0 7.99 0 [English, French, Italian, German, Spanish - Spain, Danish, Dutch, Finnish, Norwegian, Swedish] null true true false 83% 1h 15m Frontier Developments,Aspyr (Mac) [Simulation, Strategy] +[20] 951530 Alien Shooter - Last Hope Nov/2020 50000 - 100000 0 4.99 0 [English, Russian] http://www.sigma-team.net true false false 81% null Sigma Team Inc. [Action, Indie, RPG] +[21] 247370 Mutant Mudds Deluxe Nov/2013 50000 - 100000 0 9.99 0 [English] http://www.mutantmuddsdeluxe.com true false false 74% 3h 21m Renegade Kid [Action, Indie] +[22] 1879330 WARRIORS OROCHI 3 Ultimate Definitive Edition Jul/2022 50000 - 100000 0 39.99 0 [English, Simplified Chinese, Traditional Chinese, Japanese] https://www.gamecity.ne.jp/orochi2/ultimate/index.html true false false 88% null KOEI TECMO GAMES CO., LTD. [Action, Strategy] +[23] 1634290 Chuhou Joutai 2: Paraided! Jul/2021 50000 - 100000 0 4.99 0 [English, Japanese] https://drillimation.com/chuhou-joutai-2-paraided/ true false false 100% null Drillimation Systems [Action, Indie] +[24] 259570 EDEN STAR Jan/2015 50000 - 100000 0 19.99 0 [English] http://www.edenstargame.com true false false 61% 4h 31m Flix Interactive [Action, Adventure, Indie, Strategy, Early Access] +[25] 941650 The Island: Into The Mist Jan/2019 50000 - 100000 0 9.99 0 [Korean, English] https://imbada.itch.io/the-island true false false 69% 3h 14m SUPER WAVE Studio [Adventure, Indie] +[26] 768450 NUTS Feb/2021 50000 - 100000 0 19.99 1 [English, French, Italian, German, Spanish - Spain, Arabic, Dutch, Japanese, Korean, Portuguese - Brazil, Russian, Simplified Chinese, Traditional Chinese] http://nuts.game true true false 88% null Joon, Pol, Muutsch, Char & Torfi [Adventure, Simulation] +[27] 1347140 NEAR DEADline Aug/2020 50000 - 100000 0 0.00 1 [English] https://www.newgrounds.com/portal/view/736443 true true true 90% null Dumb ****ing Horse [Action, Casual, Free to Play, Indie] +[28] 722670 Chinese Chess/ Elephant Game: 象棋/ 中国象棋/ 中國象棋 Oct/2017 50000 - 100000 0 9.99 0 [Simplified Chinese, Traditional Chinese, English, Russian] null true false false 78% 1h 45m Wang Wenxi [Indie, Simulation, Strategy, Early Access] +[29] 711540 Lonely Mountains: Downhill Oct/2019 50000 - 100000 0 9.99 4 [English, French, Italian, German, Spanish - Spain, Russian, Simplified Chinese, Japanese, Korean, Portuguese - Brazil, Polish, Turkish] http://lonelymountains.com true true false 92% 1h 15m Megagon Industries [Action, Indie, Racing, Simulation, Sports] +[30] 450170 BOOR Feb/2017 50000 - 100000 0 0.99 0 [English, Spanish - Spain, French, German] http://www.dazlog.com/boor true true true 83% 4h 30m DazlogStudio [Adventure, Casual, Indie] +[31] 730 Counter-Strike: Global Offensive Aug/2012 50000000 - 100000000 0 0.00 1 [Czech, Danish, Dutch, English, Finnish, French, German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Spanish - Spain, Swedish, Thai, Traditional Chinese, Turkish, Bulgarian, Ukrainian, Greek, Spanish - Latin America, Vietnamese] http://blog.counter-strike.net/ true true true 88% 508h 4m Valve,Hidden Path Entertainment [Action, Free to Play] +[32] 598550 HUNTDOWN May/2021 50000 - 100000 0 19.99 1 [English, French, Italian, German, Spanish - Spain, Japanese, Simplified Chinese] http://huntdown.com/ true true true 95% 11h 26m Easy Trigger Games [Action, Indie] +[33] 614090 Deadbeat Heroes Oct/2017 50000 - 100000 0 14.99 0 [English] https://www.upstreamarcade.com/deadbeat-heroes/ true false false 66% 4h 36m Deadbeat Productions [Action] +[34] 809440 Protolife Jun/2018 50000 - 100000 0 11.99 0 [English, Russian] null true true false 87% 15m Volcanic Giraffe [Indie, Strategy] +[35] 1923860 Neon Outlast Mar/2022 50000 - 100000 0 4.99 0 [English] null true false false 0% null Keep Spinning [Action, Indie] +[36] 559010 Cosmic Sugar VR Nov/2016 50000 - 100000 0 0.00 1 [English] http://cosmicsugarvr.com true false false 95% 5m David Lobser [Free to Play, Simulation] +[37] 1547380 KINGDOM of the DEAD Feb/2022 50000 - 100000 0 14.99 0 [English, French, Italian, German, Spanish - Spain, Simplified Chinese, Traditional Chinese, Korean, Japanese, Polish, Portuguese - Brazil, Russian] null true false false 83% null DIRIGO GAMES [Action, Adventure, Indie] +[38] 554310 Rage Wars Nov/2016 50000 - 100000 0 0.99 0 [English] http://www.lemondo.com/ true true true 89% 4h 24m Lemondo Games [Violent, Gore, Adventure, Casual, Indie] +[39] 1124090 告死天使之言-Death angel Aug/2019 50000 - 100000 0 0.99 1 [Simplified Chinese] https://space.bilibili.com/11591868/article true false false 81% null 我妻寒十 [Adventure, Indie] +[40] 292120 FINAL FANTASY® XIII Oct/2014 500000 - 1000000 13 15.99 0 [English, French, Italian, German, Spanish - Spain] http://www.square-enix.com/ true false false 74% 28h 58m Square Enix [RPG] +[41] 691930 MSI Electric City: Core Assault Sep/2017 50000 - 100000 0 0.00 0 [English] http://msi.com/to/e-city true false false 90% 32m HyperBot Studio [Action, Adventure, Casual, Free to Play, Indie] +[42] 325420 Homebrew - Patent Unknown Nov/2014 50000 - 100000 0 14.99 0 [English] http://www.homebrewgame.com true false false 76% 5h 48m Copybugpaste [Action, Indie, Racing, Simulation, Early Access] +[43] 663670 Killer Queen Black Oct/2019 50000 - 100000 0 9.99 0 [English, French, Italian, German, Spanish - Spain, Japanese, Korean] http://www.killerqueenblack.com true true false 93% 2h 11m Liquid Bit, LLC,BumbleBear Games, LLC [Action, Casual, Sports, Strategy] +[44] 503820 A Detective's Novel Jul/2016 500000 - 1000000 0 0.99 0 [English] http://amaterasusoftware.blogspot.hr/ true false false 68% 4h 24m Amaterasu Software [Adventure, Indie] +[45] 49600 Beat Hazard Apr/2010 500000 - 1000000 0 9.99 2 [English, French, German, Italian, Spanish - Spain, Dutch] http://www.coldbeamgames.com true true true 95% 7h 36m Cold Beam Games [Action, Casual, Indie] +[46] 49300 Commander: Conquest of the Americas Jul/2010 50000 - 100000 0 9.99 2 [English, French, German, Spanish - Spain] http://www.cota-game.com/ true false false 48% 11h 48m Nitro Games [Strategy] +[47] 1631930 The Insignia Project Jul/2021 50000 - 100000 0 1.99 0 [English] https://darkendstu.com/ true false false 75% null Dark End Studios [Indie, Early Access] +[48] 1038740 Fluffy Store Aug/2019 50000 - 100000 0 1.99 1 [English, Simplified Chinese, Traditional Chinese, Japanese] null true true false 97% 3h 9m AsicxArt [Adventure, Casual, Indie, RPG] +[49] 336760 Pilot Brothers Dec/2014 50000 - 100000 0 4.99 0 [English, French, Italian, German, Spanish - Spain, Japanese, Korean, Portuguese - Brazil, Russian, Traditional Chinese, Portuguese] null true false false 87% null 1C Wireless [Adventure, Casual] +[50] 64000 Men of War: Assault Squad Feb/2011 500000 - 1000000 0 9.99 5 [English, Russian, Italian, Spanish - Spain, French, German, Polish] http://www.menofwargame.com/assault/ true false false 88% 10h 5m Digitalmindsoft [Strategy] +[51] 487580 Ludo Supremo Jun/2016 50000 - 100000 0 1.99 0 [English] http://www.ensenasoft.com true false false 57% 3h 19m EnsenaSoft [Casual] \ No newline at end of file diff --git a/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/saida.out b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/saida.out new file mode 100644 index 0000000..6a85875 --- /dev/null +++ b/tps/gabaritos/tp02/TP02Q08 - Lista sequencial em C/saida.out @@ -0,0 +1,61 @@ +(R) Have a Nice Death +(R) Sopwith VR +(R) Burn Zombie Burn! +(R) Sonic Adventure 2 +(R) Rhiannon: Curse of the Four Branches +(R) Faefever +(R) NOBUNAGA'S AMBITION: Tendou with Power Up Kit +(R) Higurashi When They Cry Hou - Ch.2 Watanagashi +(R) Synthesis Universe -Episode 00- +[0] 258520 The Vanishing of Ethan Carter Sep/2014 500000 - 1000000 0 19.99 2 [English, French, Italian, German, Spanish - Spain, Polish, Czech] http://EthanCarterGame.com true false false 89% 3h 13m The Astronauts [Adventure, Indie] +[1] 1487390 ANVIL Dec/2021 50000 - 100000 0 24.99 0 [English, Korean, German, Russian, Japanese, Simplified Chinese, Traditional Chinese, French, Polish, Portuguese - Brazil, Spanish - Latin America, Italian, Thai, Vietnamese] https://www.anvil.world/ true false false 63% 9h 51m Action Square [Action, Early Access] +[2] 1189490 觅长生 Nov/2019 500000 - 1000000 0 11.99 0 [Simplified Chinese] null true false false 91% 33h 39m Chalcedony Network [Indie, RPG, Strategy, Early Access] +[3] 300550 Shadowrun: Dragonfall - Director's Cut Sep/2014 500000 - 1000000 0 14.99 0 [English] http://harebrained-schemes.com/shadowrun/dragonfall/ true true true 89% 15h 1m Harebrained Schemes [Adventure, Indie, RPG, Strategy] +[4] 49800 Flight of the Icarus May/2010 50000 - 100000 0 4.99 0 [English] http://musegames.com/games/flight-of-the-icarus/ true true false 39% 15m Muse Games [Action, Indie] +[5] 1851280 Samurai Bringer Apr/2022 50000 - 100000 0 9.99 0 [English, Japanese, Simplified Chinese, Traditional Chinese] https://playism.com/game/samurai-bringer/ true false false 88% 5h 2m ALPHAWING Inc. [Action, Indie] +[6] 1112930 Dredgers Oct/2019 50000 - 100000 0 11.99 0 [English, Simplified Chinese] null true false false 92% null Pirate-Rob [Indie, RPG] +[7] 24720 SPORE™ Galactic Adventures Jun/2009 500000 - 1000000 0 19.99 0 [English, French, German, Italian, Spanish - Spain, Dutch, Russian, Polish, Czech, Hungarian, Finnish, Norwegian, Swedish, Danish] http://www.spore.com/what/ga true false false 88% 15h 32m EA - Maxis [Action, Simulation] +[8] 275570 Summoner Mar/2014 50000 - 100000 0 4.99 0 [English, German] null true false false 83% 3h 24m Volition [Action, RPG] +[9] 1096530 Solasta: Crown of the Magister May/2021 500000 - 1000000 0 15.99 4 [English, French, German, Simplified Chinese, Portuguese - Brazil, Russian] https://www.solasta-game.com/ true true false 89% 37h 56m Tactical Adventures [Adventure, RPG, Strategy] +[10] 690510 Immortal Soul: Black Survival Mar/2019 500000 - 1000000 0 0.00 0 [English, Japanese, Korean, French, Italian, German, Spanish - Spain, Russian, Simplified Chinese, Traditional Chinese, Thai, Portuguese, Portuguese - Brazil] null true false false 79% 28h 5m Nimble Neuron [Free to Play, Indie, Strategy] +[11] 439550 'n Verlore Verstand Apr/2016 50000 - 100000 0 14.99 1 [English, French, Italian, German, Spanish - Spain, Arabic, Bulgarian, Czech, Danish, Dutch, Finnish, Greek, Hungarian, Japanese, Korean, Norwegian, Polish, Portuguese, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Swedish, Thai, Traditional Chinese, Turkish, Ukrainian] http://www.skobbejakgames.com true true true 39% 2h 20m Skobbejak Games,Skermunkel [Adventure, Casual, Indie] +[12] 1504570 Cultivation Tales Apr/2022 500000 - 1000000 0 19.99 0 [English, Simplified Chinese] null true false false 38% 27h 42m Ac Games [Action, Adventure, Indie, RPG, Strategy, Early Access] +[13] 1369470 Pincremental Aug/2020 50000 - 100000 0 0.00 0 [English] null true true false 80% null Makopaz [Casual, Free to Play, Indie, Simulation, Strategy] +[14] 270130 The Gallery - Episode 1: Call of the Starseed Apr/2016 50000 - 100000 0 14.99 1 [English] http://www.cloudheadgames.com true false false 84% 36m Cloudhead Games ltd. [Adventure, Casual, Indie] +[15] 336150 Virtual Pool 4 May/2015 50000 - 100000 0 24.99 0 [English] http://vponline.celeris.com true false false 83% null Celeris [Sports] +[16] 1507410 Coloring Book for Kids Mar/2021 50000 - 100000 0 0.00 1 [English, French, Italian, German, Arabic, Czech, Danish, Dutch, Hungarian, Japanese, Korean, Norwegian, Polish, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Spanish - Latin America, Swedish, Thai, Turkish, Vietnamese] null true true false 89% null Peaksel [Casual, Free to Play, Indie] +[17] 573210 Mistwood Heroes Dec/2016 50000 - 100000 0 3.99 0 [English] null true false false 56% 4h Meepower [Action, Adventure, Casual, Indie, RPG] +[18] 886470 Another Otter Jul/2018 50000 - 100000 0 0.99 0 [English] null true false false 63% null PepoLab [Casual, Indie] +[19] 1368820 RollerCoaster Tycoon® 3: Complete Edition Sep/2020 50000 - 100000 0 7.99 0 [English, French, Italian, German, Spanish - Spain, Danish, Dutch, Finnish, Norwegian, Swedish] null true true false 83% 1h 15m Frontier Developments,Aspyr (Mac) [Simulation, Strategy] +[20] 951530 Alien Shooter - Last Hope Nov/2020 50000 - 100000 0 4.99 0 [English, Russian] http://www.sigma-team.net true false false 81% null Sigma Team Inc. [Action, Indie, RPG] +[21] 247370 Mutant Mudds Deluxe Nov/2013 50000 - 100000 0 9.99 0 [English] http://www.mutantmuddsdeluxe.com true false false 74% 3h 21m Renegade Kid [Action, Indie] +[22] 1879330 WARRIORS OROCHI 3 Ultimate Definitive Edition Jul/2022 50000 - 100000 0 39.99 0 [English, Simplified Chinese, Traditional Chinese, Japanese] https://www.gamecity.ne.jp/orochi2/ultimate/index.html true false false 88% null KOEI TECMO GAMES CO., LTD. [Action, Strategy] +[23] 1634290 Chuhou Joutai 2: Paraided! Jul/2021 50000 - 100000 0 4.99 0 [English, Japanese] https://drillimation.com/chuhou-joutai-2-paraided/ true false false 100% null Drillimation Systems [Action, Indie] +[24] 259570 EDEN STAR Jan/2015 50000 - 100000 0 19.99 0 [English] http://www.edenstargame.com true false false 61% 4h 31m Flix Interactive [Action, Adventure, Indie, Strategy, Early Access] +[25] 941650 The Island: Into The Mist Jan/2019 50000 - 100000 0 9.99 0 [Korean, English] https://imbada.itch.io/the-island true false false 69% 3h 14m SUPER WAVE Studio [Adventure, Indie] +[26] 768450 NUTS Feb/2021 50000 - 100000 0 19.99 1 [English, French, Italian, German, Spanish - Spain, Arabic, Dutch, Japanese, Korean, Portuguese - Brazil, Russian, Simplified Chinese, Traditional Chinese] http://nuts.game true true false 88% null Joon, Pol, Muutsch, Char & Torfi [Adventure, Simulation] +[27] 1347140 NEAR DEADline Aug/2020 50000 - 100000 0 0.00 1 [English] https://www.newgrounds.com/portal/view/736443 true true true 90% null Dumb ****ing Horse [Action, Casual, Free to Play, Indie] +[28] 722670 Chinese Chess/ Elephant Game: 象棋/ 中国象棋/ 中國象棋 Oct/2017 50000 - 100000 0 9.99 0 [Simplified Chinese, Traditional Chinese, English, Russian] null true false false 78% 1h 45m Wang Wenxi [Indie, Simulation, Strategy, Early Access] +[29] 711540 Lonely Mountains: Downhill Oct/2019 50000 - 100000 0 9.99 4 [English, French, Italian, German, Spanish - Spain, Russian, Simplified Chinese, Japanese, Korean, Portuguese - Brazil, Polish, Turkish] http://lonelymountains.com true true false 92% 1h 15m Megagon Industries [Action, Indie, Racing, Simulation, Sports] +[30] 450170 BOOR Feb/2017 50000 - 100000 0 0.99 0 [English, Spanish - Spain, French, German] http://www.dazlog.com/boor true true true 83% 4h 30m DazlogStudio [Adventure, Casual, Indie] +[31] 730 Counter-Strike: Global Offensive Aug/2012 50000000 - 100000000 0 0.00 1 [Czech, Danish, Dutch, English, Finnish, French, German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Portuguese - Brazil, Romanian, Russian, Simplified Chinese, Spanish - Spain, Swedish, Thai, Traditional Chinese, Turkish, Bulgarian, Ukrainian, Greek, Spanish - Latin America, Vietnamese] http://blog.counter-strike.net/ true true true 88% 508h 4m Valve,Hidden Path Entertainment [Action, Free to Play] +[32] 598550 HUNTDOWN May/2021 50000 - 100000 0 19.99 1 [English, French, Italian, German, Spanish - Spain, Japanese, Simplified Chinese] http://huntdown.com/ true true true 95% 11h 26m Easy Trigger Games [Action, Indie] +[33] 614090 Deadbeat Heroes Oct/2017 50000 - 100000 0 14.99 0 [English] https://www.upstreamarcade.com/deadbeat-heroes/ true false false 66% 4h 36m Deadbeat Productions [Action] +[34] 809440 Protolife Jun/2018 50000 - 100000 0 11.99 0 [English, Russian] null true true false 87% 15m Volcanic Giraffe [Indie, Strategy] +[35] 1923860 Neon Outlast Mar/2022 50000 - 100000 0 4.99 0 [English] null true false false 0% null Keep Spinning [Action, Indie] +[36] 559010 Cosmic Sugar VR Nov/2016 50000 - 100000 0 0.00 1 [English] http://cosmicsugarvr.com true false false 95% 5m David Lobser [Free to Play, Simulation] +[37] 1547380 KINGDOM of the DEAD Feb/2022 50000 - 100000 0 14.99 0 [English, French, Italian, German, Spanish - Spain, Simplified Chinese, Traditional Chinese, Korean, Japanese, Polish, Portuguese - Brazil, Russian] null true false false 83% null DIRIGO GAMES [Action, Adventure, Indie] +[38] 554310 Rage Wars Nov/2016 50000 - 100000 0 0.99 0 [English] http://www.lemondo.com/ true true true 89% 4h 24m Lemondo Games [Violent, Gore, Adventure, Casual, Indie] +[39] 1124090 告死天使之言-Death angel Aug/2019 50000 - 100000 0 0.99 1 [Simplified Chinese] https://space.bilibili.com/11591868/article true false false 81% null 我妻寒十 [Adventure, Indie] +[40] 292120 FINAL FANTASY® XIII Oct/2014 500000 - 1000000 13 15.99 0 [English, French, Italian, German, Spanish - Spain] http://www.square-enix.com/ true false false 74% 28h 58m Square Enix [RPG] +[41] 691930 MSI Electric City: Core Assault Sep/2017 50000 - 100000 0 0.00 0 [English] http://msi.com/to/e-city true false false 90% 32m HyperBot Studio [Action, Adventure, Casual, Free to Play, Indie] +[42] 325420 Homebrew - Patent Unknown Nov/2014 50000 - 100000 0 14.99 0 [English] http://www.homebrewgame.com true false false 76% 5h 48m Copybugpaste [Action, Indie, Racing, Simulation, Early Access] +[43] 663670 Killer Queen Black Oct/2019 50000 - 100000 0 9.99 0 [English, French, Italian, German, Spanish - Spain, Japanese, Korean] http://www.killerqueenblack.com true true false 93% 2h 11m Liquid Bit, LLC,BumbleBear Games, LLC [Action, Casual, Sports, Strategy] +[44] 503820 A Detective's Novel Jul/2016 500000 - 1000000 0 0.99 0 [English] http://amaterasusoftware.blogspot.hr/ true false false 68% 4h 24m Amaterasu Software [Adventure, Indie] +[45] 49600 Beat Hazard Apr/2010 500000 - 1000000 0 9.99 2 [English, French, German, Italian, Spanish - Spain, Dutch] http://www.coldbeamgames.com true true true 95% 7h 36m Cold Beam Games [Action, Casual, Indie] +[46] 49300 Commander: Conquest of the Americas Jul/2010 50000 - 100000 0 9.99 2 [English, French, German, Spanish - Spain] http://www.cota-game.com/ true false false 48% 11h 48m Nitro Games [Strategy] +[47] 1631930 The Insignia Project Jul/2021 50000 - 100000 0 1.99 0 [English] https://darkendstu.com/ true false false 75% null Dark End Studios [Indie, Early Access] +[48] 1038740 Fluffy Store Aug/2019 50000 - 100000 0 1.99 1 [English, Simplified Chinese, Traditional Chinese, Japanese] null true true false 97% 3h 9m AsicxArt [Adventure, Casual, Indie, RPG] +[49] 336760 Pilot Brothers Dec/2014 50000 - 100000 0 4.99 0 [English, French, Italian, German, Spanish - Spain, Japanese, Korean, Portuguese - Brazil, Russian, Traditional Chinese, Portuguese] null true false false 87% null 1C Wireless [Adventure, Casual] +[50] 64000 Men of War: Assault Squad Feb/2011 500000 - 1000000 0 9.99 5 [English, Russian, Italian, Spanish - Spain, French, German, Polish] http://www.menofwargame.com/assault/ true false false 88% 10h 5m Digitalmindsoft [Strategy] +[51] 487580 Ludo Supremo Jun/2016 50000 - 100000 0 1.99 0 [English] http://www.ensenasoft.com true false false 57% 3h 19m EnsenaSoft [Casual]