Advertisement
Guest User

Why

a guest
Jul 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Xml;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace Social_algorithim
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         int Animal = 50;
  17.         int Tech = 50;
  18.         Random Rand = new Random();
  19.         bool Liked;
  20.         string CurrentPic = "Animal";
  21.         int CurrentRand;
  22.         Image Animal1Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Animals\Animal1.png");
  23.         Image Animal2Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Animals\Animal2.png");
  24.         Image Animal3Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Animals\Animal3.png");
  25.         Image Animal4Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Animals\Animal4.png");
  26.         Image Animal5Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Animals\Animal5.png");
  27.         Image Tech1Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Tech\Tech1.png");
  28.         Image Tech2Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Tech\Tech2.png");
  29.         Image Tech3Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Tech\Tech3.png");
  30.         Image Tech4Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Tech\Tech4.png");
  31.         Image Tech5Pic = Image.FromFile(@"C:\Users\DotCD\Desktop\Algorithim\Tech\Tech5.png");
  32.         public Form1()
  33.         {
  34.             InitializeComponent();
  35.             pictureBox1.Image = Animal1Pic;
  36.         }
  37.  
  38.         private void Form1_Load(object sender, EventArgs e)
  39.         {
  40.            
  41.         }
  42.         //next button
  43.         private void button1_Click(object sender, EventArgs e)
  44.         {
  45.             if (Liked == true)
  46.             {
  47.                 if (CurrentPic == "Animal")
  48.                 {
  49.                     Animal = Animal + 5;
  50.                     Tech = Tech - 5;
  51.                     Liked = false;
  52.                 }
  53.                 if (CurrentPic == "Tech")
  54.                 {
  55.                     Tech = Tech + 5;
  56.                     Animal = Animal - 5;
  57.                     Liked = false;
  58.  
  59.                 }
  60.             }
  61.  
  62.             if (Tech < Animal)
  63.  
  64.             {
  65.  
  66.                 CurrentRand = Rand.Next(1, 100);
  67.  
  68.  
  69.  
  70.                 if (CurrentRand > Tech)
  71.  
  72.                 {
  73.  
  74.                     ShowAnimal();
  75.  
  76.                 }
  77.  
  78.  
  79.                 if (CurrentRand < Tech)
  80.  
  81.                 {
  82.  
  83.                     ShowTech();
  84.  
  85.                 }
  86.  
  87.                 else
  88.  
  89.                 {
  90.  
  91.                     ShowAnimal();
  92.  
  93.                 }
  94.  
  95.             }
  96.  
  97.             if (Tech > Animal)
  98.             {
  99.  
  100.                 CurrentRand = Rand.Next(1, 100);
  101.                 if (CurrentRand > Animal)
  102.                 {
  103.                     ShowTech();
  104.                 }
  105.  
  106.                 if (CurrentRand < Animal)
  107.                 {
  108.                     ShowAnimal();
  109.                 }
  110.  
  111.                 else
  112.                 {
  113.                     ShowTech();
  114.                 }
  115.  
  116.             }
  117.            
  118.         }
  119.         //like button
  120.         private void button2_Click(object sender, EventArgs e)
  121.         {
  122.             Liked = true;
  123.         }
  124.  
  125.         private void ShowAnimal()
  126.         {
  127.             CurrentPic = "Animal";
  128.             CurrentRand = Rand.Next(1, 5);
  129.             if(CurrentRand == 1)
  130.             {
  131.                 pictureBox1.Image = Animal1Pic;
  132.                 textBox1.Text = pictureBox1.Image.ToString();
  133.             }
  134.             if(CurrentRand == 2)
  135.             {
  136.                 pictureBox1.Image = Animal2Pic;
  137.                 textBox1.Text = pictureBox1.Image.ToString();
  138.             }
  139.             if(CurrentRand == 3)
  140.             {
  141.                 pictureBox1.Image = Animal3Pic;
  142.                 textBox1.Text = pictureBox1.Image.ToString();
  143.             }
  144.             if(CurrentRand == 4)
  145.             {
  146.                 pictureBox1.Image = Animal4Pic;
  147.                 textBox1.Text = pictureBox1.Image.ToString();
  148.             }
  149.             if(CurrentRand == 5)
  150.             {
  151.                 pictureBox1.Image = Animal5Pic;
  152.                 textBox1.Text = pictureBox1.Image.ToString();
  153.             }
  154.         }
  155.         private void ShowTech()
  156.         {
  157.             CurrentPic = "Tech";
  158.             CurrentRand = Rand.Next(1, 5);
  159.             if (CurrentRand == 1)
  160.             {
  161.                 pictureBox1.Image = Tech1Pic;
  162.                 textBox1.Text = pictureBox1.Image.ToString();
  163.             }
  164.             if (CurrentRand == 2)
  165.             {
  166.                 pictureBox1.Image = Tech2Pic;
  167.                 textBox1.Text = pictureBox1.Image.ToString();
  168.             }
  169.             if (CurrentRand == 3)
  170.             {
  171.                 pictureBox1.Image = Tech3Pic;
  172.                 textBox1.Text = pictureBox1.Image.ToString();
  173.             }
  174.             if (CurrentRand == 4)
  175.             {
  176.                 pictureBox1.Image = Tech4Pic;
  177.                 textBox1.Text = pictureBox1.Image.ToString();
  178.             }
  179.             if (CurrentRand == 5)
  180.             {
  181.                 pictureBox1.Image = Tech5Pic;
  182.                 textBox1.Text = pictureBox1.Image.ToString();
  183.             }
  184.         }
  185.     }
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement