Top 20

1 0x00h 705 pts
2 boris39 705 pts
3 neoxquick 686 pts
4 maf-ia 667 pts
5 thefinder 648 pts
6 benito255 612 pts
7 mego 594 pts
8 madbat2 585 pts
9 Mart 557 pts
10 tehron 507 pts
11 Kithyane 506 pts
12 plucth 483 pts
13 egosum 477 pts
14 CoYoTe99 420 pts
15 Undr 418 pts
16 Zeta 418 pts
17 loonies2 414 pts
18 Armavica 413 pts
19 vitalimarrenra 406 pts
20 b0n0n 398 pts

Classement complet

Shoutbox

20 Sep - 10:46 am

Bonjour à tous, j'ai créé un nouveau topic sur le forum concernant un problème que je rencontre sur plusieurs challenges, comme il n'est plus très actif, que j'aimerais pouvoir avancer sur ces challenges et que ce chat a une meilleure visibilité, je poste ce message ici en espérant qu'une âme charitable puisse m'aider en répondant à mon message sur le forum :)

3 Sep - 9:39 am

Ah ok je n'avais pas bien compris ton message original. Très bien, ce que tu peux faire c'est poster un message sur le forum avec le lien de téléchargement et les explications. Merci pour ta contribution !

1 Sep - 5:52 pm

Bonjour bonjour, je l'ai créé en Pharo, une implémentation récente du langage smalltalk.

31 Aug - 2:43 pm

Bonjour PharoGuy, re-bienvenue à toi ! Tu as créé cet objet en quel langage ?

30 Aug - 8:23 pm

Bonjour tout le monde ! je redécouvre ce site avec Pharo ! J'ai créé un objet qui gère la récupération et l'envoi des variables, ça pourrait intéresser ?

24 Jul - 5:30 pm

Ça devrait être à nouveau opérationnel, définitivement cette fois ci.

19 Jul - 8:42 pm

A nouveau ? On regarde ça !

16 Jul - 5:26 pm

Bonjour à tous :) Je viens d'essayer de valider le challenge "Wav ? (6)", et j'ai l'impression que la page "validation.php" est de nouveau en carafe.

15 Jul - 8:43 pm

Cool !! Merci beaucoup !!

9 Jul - 11:20 pm

Hello, je regarde ça dès que je peux, probablement demain

Connexion
Mot de passe oublié

Supportez nousx

Vous aimez µContest ?
Supportez nous en votant (fun et difficulté) pour µContest sur WeChall :)
Si vous ne l'avez pas encore fait, profitez-en pour lier votre compte
Wechall à µContest pour pouvoir voter !

Merci

Contents

µContest, what is it ? How to participate ? How to solve the challenges proposed ? What language ? You will find all the answers to theses questions in this page. Concerning more specific questions, you can ask them on the forum.

General

How to solve a challenge

The µContest libraries

Example of a challenge resolution I

Example of a challenge resolution II

Technical documentations

Library C/C++ documentation

General information

Current version : 2.1

The library contains functions that enable you

  • to check if the lib is up to date
  • to get the variable values of a challenge
  • to send back the answer(s) you found to the website
  • print formatted results
The particularity of the version 2 is that all the code is contained in 1 single file, microcontest2.h you should put in the same directory than your source file.
You just have to include the lib by doing :
#include "microcontest2.h"

Available functions

Here is a list of the functions you can use :

Function Prototype Description
- MC_CheckLibVersion - int MC_CheckLibVersion(int *pLibUpToDate) Checks if the lib is up to date
- MC_StartContest - int MC_StartContest(int ContestID, const char *pNickname, const char *pPassword) Gets the variables from the website
- MC_GetParam_int
- MC_GetParam_float
- MC_GetParam_char
- int MC_GetParam_int(const char *pVariableName, int *pVariable_int)
- int MC_GetParam_float(const char *pVariableName, float *pVariable_float)
- int MC_GetParam_char(const char *pVariableName, char **ppVariable_char, unsigned int *pLength)
Give you the variables downloaded by MC_StartContest
- MC_AddVariableToSolution_int
- MC_AddVariableToSolution_float
- MC_AddVariableToSolution_char
- int MC_AddVariableToSolution_int(const char *pVariableName, int Variable)
- int MC_AddVariableToSolution_float(const char *pVariableName, float Variable)
- int MC_AddVariableToSolution_char(const char *pVariableName, const char *pVariable, int Length)
Add answers to the final solution
- MC_SendSolution - int MC_SendSolution(MC_ResultStruct *pResult) Sends the final solution to the website
- MC_ResultMessage - char* MC_ResultMessage(MC_ResultStruct *pResult, int Print) Prints a summary of the results (success, points...)
- MC_ErrorMessage - char* MC_ErrorMessage(unsigned int ErrorCode, int Print) Prints a message associated with an error code

Available symbols

Here is a list of the error codes defined in microcontest2.h :

Error Code Value Description
MC_OK 0 No error.
MC_ERROR_VERSION 1 This version of the microcontest2 library does not work anymore. Please download the last one on www.microcontest.com/download.php.
MC_ERROR_CONNECTION 2 A connection problem happened.
MC_ERROR_IDENTITY 3 An authentification problem happened.
MC_ERROR_IDENTITY_UNKNOWNUSER 4 This username does not exist.
MC_ERROR_IDENTITY_NONACTIVATED 5 Your account has not been activated yet.
MC_ERROR_IDENTITY_PASSWORD 6 Wrong password.
MC_ERROR_MEMORY 7 A memory error happened.
MC_ERROR_FORMAT 8 The data sent by the server is not formatted properly.
MC_ERROR_UNKNOWN 9 An unknown error happened.
MC_ERROR_SERVER 10 The HTTP server has a problem or the microcontest2 library sent incorrectly formatted data.
MC_ERROR_BRUTEFORCE 11 Bruteforce error.
MC_ERROR_BADCTENCODING 12 The data sent by the server is not formatted properly (Bad Chuncked Transfer Encoding).

Available structures

typedef struct
{
	int success;
	int timeout;
	int already;
	int points;
	int error;
	char msg_error[1024];
} MC_ResultStruct;

MC_CheckLibVersion

Prototype / Description

int MC_CheckLibVersion(int *pLibUpToDate)

Enables you to check if the lib version if up to date.

Parameters

  • [out] int *pLibUpToDate : A pointer on a int variable that will receive 1 if the library is up to date, 0 otherwise.

Return value

  • [out] int : An error code (see here)

Example

int LibUpToDate = 0;
			
ErrorCode = MC_CheckLibVersion(&LibUpToDate);           
if(ErrorCode != MC_OK)
{
    MC_ErrorMessage(ErrorCode, 1);
    return 0;
}
else if(LibUpToDate == 0)
{
    printf("Warning: the version of the libmicrocontest2 is not the last one.\n");
    printf("Current version:\t%s\n", MC_LIBVERSION);
    printf("This program may not work properly. Consider downloading the latest version on\nthis page : http://www.microcontest.com/download.php\n\n");
}

MC_StartContest

Prototype / Description

int MC_StartContest(int ContestID, const char *pNickname, const char *pPassword)

Downloads new variable values from the website and store it. You need to use MC_GetParam_xxx to get them.

Parameters

  • [in] int ContestID : The ID of the contest you want to solve, written on every contest page.
  • [in] const char *pNickname : Your nickname
  • [in] const char *pPassword : Your password

Return value

  • [out] int : An error code (see here)

Example

ErrorCode = MC_StartContest(13, "Your nickname", "Your password");   // Challenge 13
if(ErrorCode != MC_OK)
{
	MC_ErrorMessage(ErrorCode, 1);
	return 0;
}

MC_GetParam_int

Prototype / Description

int MC_GetParam_int(const char *pVariableName, int *pVariable_int)

Once you called MC_StartContest, you can retrieve the int variables values with this function.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] int *pVariable_int) : A pointer on a int variable that will receive the variable value.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Nb1 = 0, Nb2 = 0;
			
ErrorCode = MC_GetParam_int("a", &Nb1);
ErrorCode *= MC_GetParam_int("b", &Nb2);
if(ErrorCode == 0)
{
	printf("Impossible to get the contest data. Please check the ID of the contest.\n");
	return 0;
}

MC_GetParam_float

Prototype / Description

int MC_GetParam_float(const char *pVariableName, float *pVariable_float)

Once you called MC_StartContest, you can retrieve the float variables values with this function.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] float *pVariable_int) : A pointer on a float variable that will receive the variable value.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

float Nb = 0;
			
ErrorCode = MC_GetParam_float("height", &Nb);
if(ErrorCode == 0)
{
	printf("Impossible to get the contest data. Please check the ID of the contest.\n");
	return 0;
}

MC_GetParam_char

Prototype / Description

int MC_GetParam_char(const char *pVariableName, char **ppVariable_char, unsigned int *pLength)

Once you called MC_StartContest, you can retrieve the string variables values with this function. Note that it is the library that allocates the memory for the strings and frees it automatically. You don't need to take care of that.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] char **ppVariable_char : A pointer on a char* pointeur that will receive the adress of the string. You can use it as a regular buffer.
  • [out] unsigned int *pLength : A pointer on an unsigned int variable that will receive the length of the string.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

char *pCryptedText = NULL;
unsigned int CryptedTextLength = 0;
int Key = 0;
			
ErrorCode = MC_GetParam_char("txt_crypte", &pCryptedText, &CryptedTextLength);
ErrorCode *= MC_GetParam_int("key", &Key);
if(ErrorCode == 0)
{
    printf("Impossible to get the contest data. Please check the ID of the contest.\n");
    return 0;
}

MC_AddVariableToSolution_int

Prototype / Description

int MC_AddVariableToSolution_int(const char *pVariableName, int Variable)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will call MC_SendSolution that will send all your answers to the website. You should use this function to add int variables to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] int Variable : The int variable you want to add to the solution.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Number = 0;
			
// computing the value of Number...

ErrorCode = MC_AddVariableToSolution_int("frequency", Number);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_AddVariableToSolution_float

Prototype / Description

int MC_AddVariableToSolution_float(const char *pVariableName, float Variable)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will can MC_SendSolution that will send all your answers to the website. You should use this function to add float variables to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] float Variable : The float variable you want to add to the solution.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Freq = 0;
float Duration = 0;
			
// computing the value of Freq and Duration...

ErrorCode = MC_AddVariableToSolution_int("frequency", Freq);
ErrorCode *= MC_AddVariableToSolution_float("duration", Duration);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_AddVariableToSolution_char

Prototype / Description

int MC_AddVariableToSolution_char(const char *pVariableName, const char *pVariable, int Length)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will can MC_SendSolution that will send all your answers to the website. You should use this function to add strings to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] const char *pVariable : The string you want to add to the solution.
  • [int] int Length : The length of the string you want to add to the solution. Be carefull, use the function strlen only if you are sure there are no null characters inside.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

char PlainText[] = "HELLO THIS IS THE SOLUTION STRING";

ErrorCode = MC_AddVariableToSolution_char("plain_text", PlainText, strlen(PlainText);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_SendSolution

Prototype / Description

int MC_SendSolution(MC_ResultStruct *pResult)

Once you solved the challenge and added all the answer variables to the solution, you need to call this function in order to send the solution to the website. *pResult is filled with the results.

Parameters

  • [out] MC_ResultStruct *pResult : A pointer on a MC_ResultStruct variable that will receive the results of the challenge (succeeded or not, points earned etc). Use the function MC_ResultMessage in order to visualise the results. See here for more details about this structure.

Return value

  • [out] int : An error code (see here).

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);

MC_ResultMessage

Prototype / Description

char* MC_ResultMessage(MC_ResultStruct *pResult, int Print)

Once you sent the solution, a MC_ResultStruct structure has been filled. Use this function to get a formatted summary of the results. You can choose to print it or the get a pointer on the formatted string.

Parameters

  • [in] MC_ResultStruct *pResult : A pointer on a MC_ResultStruct variable that has been filled with the results by MC_SendSolution. See here for more details about this structure.
  • [in] int Print : 1 if you want to print the summary in the standard output, or 0 otherwise.

Return value

  • [out] char* : A pointer on the formatted result string.

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);

MC_ErrorMessage

Prototype / Description

char* MC_ErrorMessage(unsigned int ErrorCode, int Print)

Most of the functions of the library return an error code. You can consult the meaning here, or use this function.

Parameters

  • [in] unsigned int ErrorCode : The error code you want to get the message.
  • [in] int Print : 1 if you want to print the error message in the standard output, or 0 otherwise.

Return value

  • [out] char* : A pointer on the formatted error message string.

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);