Skip to content
Snippets Groups Projects
Commit 51d29ba4 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

luento14

parent c14625bd
No related branches found
No related tags found
No related merge requests found
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.luento14.iml
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Jypeli;
using Jypeli.Assets;
using Jypeli.Controls;
using Jypeli.Effects;
using Jypeli.Widgets;
/// @author Vesa Lappalainen
/// @version 22.10.2012
......@@ -38,9 +33,9 @@ public class LaskeMatka : PhysicsGame
// private Vector[] pisteet = new Vector[10]; // taulukolle
// private int lkm = 0; // taulukolle
private List<Vector> pisteet = new List<Vector>(); // listalle
private readonly List<Vector> pisteet = new List<Vector>(); // listalle
private DoubleMeter yhteismatka = new DoubleMeter(200);
private readonly DoubleMeter yhteismatka = new DoubleMeter(200);
private Label matkanytto;
public override void Begin()
......@@ -131,7 +126,7 @@ public class LaskeMatka : PhysicsGame
Mouse.IsCursorVisible = true;
Keyboard.Listen(Key.Delete, ButtonState.Pressed, PoistaPisteet, "Poistaa kaikki pisteet");
Mouse.Listen(MouseButton.Left, ButtonState.Pressed, delegate () { LisaaPiste(Mouse.PositionOnWorld); }, "Laita piste");
Mouse.Listen(MouseButton.Left, ButtonState.Pressed, delegate { LisaaPiste(Mouse.PositionOnWorld); }, "Laita piste");
Mouse.Listen(MouseButton.Right, ButtonState.Pressed, PoistaPisteet, "Laita piste");
// TouchPanel.Listen(ButtonState.Pressed, delegate(Touch kosketus) { SiirraMerkkipisteet(kosketus.PositionOnWorld); }, null);
......@@ -206,7 +201,7 @@ public class LaskeMatka : PhysicsGame
/// </summary>
public class Axis
{
private double x1, x2, y1, y2;
private readonly double x1, x2, y1, y2;
public Color Color { set; get; }
/// <summary>
......
using System;
using System.Text;
/// @author Vesa Lappalainen
/// @version 11.10.2011
......@@ -20,7 +19,7 @@ public class Matriisit
{1,0,1},
{1,8,9}
};
int[,] mat2 = new int[6, 5];
// int[,] mat2 = new int[6, 5];
int lkm = MonellakoRivilla(mat, 1);
Console.WriteLine("1 oli {0} rivillä", lkm);
......
// ReSharper disable all
using System;
using NUnit.Framework;
using static Matriisit;
[TestFixture]
[DefaultFloatingPointTolerance(0.000001)]
public class TestMatriisit
{
[Test]
public void TestMonellakoRivilla37()
{
int[,] t = {{2,1,2},
{3,4,2},
{1,0,1},
{1,8,9}};
Assert.AreEqual( 2, MonellakoRivilla(t,2) , "in method MonellakoRivilla, line 42");
Assert.AreEqual( 0, MonellakoRivilla(t,5) , "in method MonellakoRivilla, line 43");
Assert.AreEqual( 1, MonellakoRivilla(t,0) , "in method MonellakoRivilla, line 44");
Assert.AreEqual( 3, MonellakoRivilla(t,1) , "in method MonellakoRivilla, line 45");
Assert.AreEqual( 0, MonellakoRivilla(new int[0,0],1) , "in method MonellakoRivilla, line 46");
}
[Test]
public void TestSumma72()
{
int[,] t = {{2,1,2},{3,4,2},{1,0,1},{1,8,9}};
Assert.AreEqual( 34, Matriisit.Summa(t) , "in method Summa, line 74");
Assert.AreEqual( 5, Matriisit.Summa(new int[1,1]{{5}}) , "in method Summa, line 75");
Assert.AreEqual( 0, Matriisit.Summa(new int[0,0]) , "in method Summa, line 76");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.1"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Matriisit\Matriisit.csproj"/>
</ItemGroup>
</Project>
using System;
using System.Text;
// ReSharper disable all
public class Muuttujat
{
public static void Main(string[] args)
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Matriisit", "Matriisit\Matriisit.csproj", "{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaskeMatka", "LaskeMatka\LaskeMatka.csproj", "{9486A8C6-9592-451D-99D6-58CABE6C5B5E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Muuttujat", "Muuttujat\Muuttujat.csproj", "{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatriisitTest", "MatriisitTest\MatriisitTest.csproj", "{7AF9CFB3-84BD-4E0F-A33A-D0D4EC27A5A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.Build.0 = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.Build.0 = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E95C43B3-E5CA-42DE-A29B-97A67C61411B}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.Build.0 = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.Build.0 = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.Build.0 = Release|Any CPU
{7AF9CFB3-84BD-4E0F-A33A-D0D4EC27A5A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7AF9CFB3-84BD-4E0F-A33A-D0D4EC27A5A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AF9CFB3-84BD-4E0F-A33A-D0D4EC27A5A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AF9CFB3-84BD-4E0F-A33A-D0D4EC27A5A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E95C43B3-E5CA-42DE-A29B-97A67C61411B}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Matriisit", "Matriisit\Matriisit.csproj", "{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LaskeMatka", "LaskeMatka\LaskeMatka.csproj", "{9486A8C6-9592-451D-99D6-58CABE6C5B5E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Muuttujat", "Muuttujat\Muuttujat.csproj", "{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33FDFB22-F515-4B83-A3EB-D50FFD56D75B}.Release|Any CPU.Build.0 = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9486A8C6-9592-451D-99D6-58CABE6C5B5E}.Release|Any CPU.Build.0 = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D84D4EA0-50AC-4AD9-9ED5-2C5612D8CBB3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E95C43B3-E5CA-42DE-A29B-97A67C61411B}
EndGlobalSection
EndGlobal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment