• Log in or sign up for an account here: https://www.sythe.org/login

Someone help me solve this C# code

I 1337 I

Guru

Banned
Joined
Aug 18, 2007
Sythe Gold
0
Messages
1,158
Location
Finland
E: Sorry, accidently made 2 topics because sythe.org lagged so I didnt notice that it already made a topic. Apologies

Ok so theres 1 competition (Finnish one), i need to solve this C# CODE


Mission: Find the new location for the righter (probably means the ball2) ball after the collision! The solution is hidden in the C # code. The final answer has to be crypted in the correct algothrim before entering it in the field.


Code:
private void InitializeComponents()
{
RootLayout.Width = 800; RootLayout.Height = 600;
Ball1 = new Ball();
Ball2 = new Ball();
allBalls = new List<Ball>();
Ball1.Width = Ball1.Height = 50;
Ball1.Velocity.X = 3.0;
Ball1.Name = "Ball1";
Ball1.Shape.Width = Ball1.Shape.Height = 40;
Ball1.Mass = Ball1.Shape.Width / Ball1.Width;
Canvas.SetLeft(Ball1.Shape, -Ball1.Shape.Width / 2);
Canvas.SetTop(Ball1.Shape, -Ball1.Shape.Height / 2);
Canvas.SetLeft(Ball1, (Ball1.Shape.Width - Ball1.Width) / 2);
Canvas.SetTop(Ball1, 275);
RootLayout.Children.Add(Ball1);
allBalls.Add(Ball1);


Ball2.Velocity.X = -6.0;
Ball2.Width = Ball2.Height = 50;
Ball2.Name = "Ball2";
Ball2.Shape.Width = Ball2.Shape.Height = 20;
Ball2.Mass = Ball2.Shape.Width / Ball2.Width;
Canvas.SetLeft(Ball2.Shape, -Ball2.Shape.Width / 2);
Canvas.SetTop(Ball2.Shape, -Ball2.Shape.Height / 2);
Canvas.SetLeft(Ball2, RootLayout.Width - Ball2.Shape.Width + (Ball2.Shape.Width - Ball2.Width) / 2);
Canvas.SetTop(Ball2, 275);
RootLayout.Children.Add(Ball2);
allBalls.Add(Ball2);
// Move is a name of Storyboard, which duration is 0
Move.Completed += new EventHandler(Move_Completed);
Move.Begin();
}

private void Move_Completed(object sender, EventArgs e)
{

if(_firstTimeCollided == true)
{
// The key and vector are supposed to be generated randomly, but they are expossed publicly for this quiz purpose
byte[] symmetricAlgorithm_Key = {0x39, 0x2f, 0x14, 0x05, 0x68, 0x70, 0x6e, 0x14, 0x05, 0x68, 0x27, 0x36, 0x14, 0x05, 0x68, 0x38, 0x16, 0x14,
 0x05, 0x68, 0x7c, 0x4d, 0x14, 0x05, 0x68, 0x20, 0x5d, 0x14, 0x05, 0x68, 0x1c, 0x6a};
byte[] symmetricAlgorithm_IV = { 0x39, 0x70, 0x27, 0x38, 0x7, 0x1c, 0x2f, 0x6e, 0x36, 0x16, 0x4d, 0x6a, 0x39, 0x70, 0x27, 0x38 };
double newB2PosX = retrieveSecondBallPositionAfterFirstCollision();
string result = (Convert.ToString(newB2PosX)).Substring(0,2);
// Encrypt the string result with AES algorithm by using the key and the vector, then transform it to
// readable Base64 Text
string encryptedResult = GetAesEncryptedBase64Text(Encoding.UTF8.GetBytes(result), symmetricAlgorithm_Key, symmetricAlgorithm_IV) as string;
}
}


If someone could please tell me the correct answer. Thanks!
 
Do this with Game Maker. yoyogames.com/gamemaker.
 
Rofl Gamemaker
 
Runescape Gamblingrunescape gambling
Back
Top