About
Hi I'm Mudau Davis From Johannesburg, South Africa. Coding helped to understand
1's and 0's in a new way that there is more in 1's and 0's than 0 and 1.
I spend most of my time coding in C++ and Java as a back end developer. All of my coding projects
are done using classes(OOP). I believe in using the skills to change the world for better and learning more and more technologies
| Skills
| Contact
you can email me @ mudau.n4@gmail.com or follow me on Social media Platforms.Recent-Project(https://github.com/netshedzo/QRoauth/)
| Summary
To me Object Orientated Programming
together with Machine Learning can be used to do more than
what we are using it for, for example we can use it for understanding human behavior and
monitoring the changes in humans and the environment,lastly it can be used to detect and prevent sicknesses and disasters. Having the righ amount of data can enable us to tackle more problems in society
|
---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | public void DistanceAlgorith2(ArrayList<FactoryClass> ThisList) { ArrayList<FactoryClass> ElementType = new ArrayList<FactoryClass>(); if(Element != "") { for(FactoryClass a : ThisList) { if(a.NameTag.toUpperCase() == Element) { ElementType.add(a); } } int Index = 0 ; try { int Distance =Math.abs(ElementType.get(0).Xpos - this.Xpos) + Math.abs(ElementType.get(0).Ypos - this.Ypos) ; if(Distance < 0) Distance = Distance*-1; System.out.println("I was here"); int LocalDistance = 0; int LocalIndex = 0; for(FactoryClass a : ElementType) { LocalDistance = Math.abs(a.Xpos - this.Xpos) + Math.abs(a.Ypos - this.Ypos) ; if(LocalDistance < 0) LocalDistance = LocalDistance*-1; if(Distance > LocalDistance) { Distance = LocalDistance; Index = LocalIndex; } LocalIndex++; } this.TargetXX = ElementType.get(Index).Xpos; this.TargetYY = ElementType.get(Index).Ypos; this.OutPut += ElementType.get(Index).Index + "," ; this.ToFactory = true; }catch(IndexOutOfBoundsException ex) { } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | public void CheckRange() { if(BugPosX >= PositionX && BugPosY >= PositionY) { if((BugPosX - PositionX) <= 5 && (BugPosY - PositionY) <= 5) { CloseBug = true; } }else if((BugPosX >= PositionX && BugPosY < PositionY )) { if((BugPosX - PositionX) <= 5 || (PositionY - BugPosY) <= 5) { CloseBug = true; } }else if((BugPosX < PositionX && BugPosY >= PositionY )) { if(( PositionX - BugPosX) <= 5 && (BugPosY - PositionY) <= 5) { CloseBug = true; } }else if(BugPosX < PositionX && BugPosY < PositionY) { if(( PositionX - BugPosX) <= 5 && ( PositionY - BugPosY) <= 5) { CloseBug = true; } }else { CloseBug = false; } } private int CalculateTotal(Ants Ant) { int Total = 0 ; int intX = 0 ; int intY = 0; if(Ant.getXposition() > this.getXposition()) { intX =Ant.getXposition()-this.getXposition(); }else { intX =this.getXposition()-Ant.getXposition(); } if(Ant.getYposition() > this.getYposition()) { intY =Ant.getYposition()-this.getYposition(); }else { intX = this.getYposition()-Ant.getYposition(); } Total =intX + intY; if(Total <= 5) { AntClosest = Ant; Total += 200000; //to avoid setting the wrong target } return Total; } public void UpdateBugPos(Point A) { BugPosX = A.x; BugPosY = A.y; } public void SetAntTarget(ArrayList<Ants> ant) { Ants AntTest = ant.get(0); int intTotal = CalculateTotal(AntTest); if(ant != null ) { for(Ants b : ant) { if(b != AntClosest && b != this) { int localTotal = CalculateTotal(b); if(localTotal < intTotal) { AntTest = b; intTotal = localTotal; } } } if(!FollowAnts) { targetX = AntTest.getXposition(); targetY = AntTest.getYposition(); } } } |