Logica's Posts
Nairaland Forum › Logica's Profile › Logica's Posts
1 2 3 4 5 6 7 8 ... 207 208 209 210 211 212 213 214 215 (of 228 pages)
Unfortunately, because of the general tendency of the Northern cities to indulge in ethnic cleansing I will not be going. I really think they should move the conference to Lagos. |
I think you should start one. |
I don't expect you to start with sentence translations. Without having any technical knowledge of context, grammar, sentential forms, etc you'll be wasting your time. It's best to start with a simple word translator. |
realnaija:Really? Then why did you say everything you can think of has been done? |
Seun:It makes no sense that you cannot point out the contradictions (you probably don't know the meaning of that). And what do I have to gain by disagreeing with you? Maybe you need lessons in reading and comprehension; otherwise you wouldn't be asking me for an answer I already provided. In any case, I'll give you a clue: the reason is the same you will not find many old accountants (even though the profession dates back several centuries), but you will find them as Accounts Managers and owners of Accounting firms. |
Seun:That is not the reason. You can definitely find web developers of advanced ages in the US for instance. They sometimes have a history of programming, but most I've found don't, and have gone through several different careers before settling for software development (which mostly explains why they are still in the development tier, and not managerial tier, as they have fewer years of experience in the field than their age mates). If you've had a long history in software development, you usually get promoted out of the development level to the managerial level. But a few don't like the managerial level, and stick to development. |
Why don't u come up with a translator for at least 3 major Nigerian native languages? That, as a matter of fact will be useful to all foreigners interested in the country. |
Dude, I'll address what I quickly picked from your post: Tic-Tac-Toe is so trivial, that it doesn't require an evaluation function or even Minimax for that matter: there is a strategy for figuring out the best move at any time. You can actually enumerate the whole game tree within a few minutes by running a program written for that purpose (that can not be said for Chess or even Ayo). And even if you use Minimax, with the maximum number of moves in any game being 9 and a branch factor of probably less than 3, it is not even worth being used as a case study for Minimax/Alpha-beta. Not many algorithms are obvious, in fact I don't know any that is. They all arise from years of experimentation and work, which result patterns being identified and in rules-of-thumb. |
Besides the database can only do numeric and string sorts. Anything more than that will quickly get complex. |
candylips:Well, the simple fact is, computers will not be able to play humans in games of perfect information such as Chess, Checkers, Go, etc without this algorithm. Of course you also need a good evaluation function (which gives a numeric value to a game position, and the higher this value, the better it favors the player from whose perspective the position is viewed - such as 'White' in chess). For instance chess computers like Deep Blue have this algorithm and evaluation function implemented in hardware, not software. Minimax algorithm is also utilized in a branch of Operations Research (Economics) called Game Theory on Zero Sum Two-Player games (unsurprisingly, as you can see the connection), which I believe is used to simulate dynamics in market systems. |
I am comparing the JPA @OrderBy and the Hibernate @Sort. I prefer the @Sort because it is based on the Java Collections API and can therefore handle more complex sort needs. @OrderBy as you pointed out can only be used in an SQL query, whereas @Sort is not tied to SQL. |
Seun:Minimax? Have you ever tried to implement it? Have you implemented any before? Can you please delete all my posts (except for this of course) after my second post? Thanks. |
Minimax/Alpha-beta Pruning I first saw the algorithm in a magazine of which I can't recall the name or edition/date since it was back in '96, and then later saw a variant in the book "Encyclopedia of Artificial Intelligence". I first implemented in QBasic, then C, then Java. Unfortunately I no longer have the code, but I can definitely come up with something even better than I had back then (thanks to experience of course). Here is the algorithm as found on Wikipedia: http://en.wikipedia.org/wiki/Alpha-beta_pruning The algorithm is on that page. I cannot post it here since the "smart" bot thinks it's likely to be some attempt to embed Javascript or something (it is smart enough to know it's code, but not smart enough to know it's pseudo). |
Minimax/Alpha-beta Pruning I first saw the algorithm in a magazine of which I can't recall the name or edition/date since it was back in '96, and then later saw a variant in the book "Encyclopedia of Artificial Intelligence". I first implemented in QBasic, then C, then Java. Unfortunately I no longer have the code, but I can definitely come up with something even better than I had back then (thanks to experience of course). Here is the algorithm as found on Wikipedia: http://en.wikipedia.org/wiki/Alpha-beta_pruning functn alphabeta(node, depth, α, β) (* β represents previous player best choice - doesn't want it if α would worsen it *) if depth = 0 "or" node is a terminal node return the heuristic value of node foreach child of node α := max(α, -alphabeta(child, depth-1, -β, -α)) (* use symmetry, -β becomes subsequently pruned α *) if β≤α break (* Beta cut-off *) return α (* Initial call *) alphabeta(origin, depth, -infinity, +infinity) |
Depth First For the problem being solved, check the Blackplanet site for the puzzles. It shouldn't be difficult to figure which the solves. Here is the main class. I can send the rest if there's any interest. |
Minimax/Alpha-beta I initially got the pseudo-code from a magazine back in '96 but I can't remember the name or the edition. I got another variation from the "Encyclopedia of Artificial Intelligence" by Stuart Shapiro. I don't have any of the code anymore (written first in QBasic then C, then Java). I'm sure I can come up with something better at the moment if I feel like. But I got this from Wikipedia: http://en.wikipedia.org/wiki/Alpha-beta_pruning function alphabeta(node, depth, α, β) (* β represents previous player best choice - doesn't want it if α would worsen it *) if depth = 0 "or" node is a terminal node return the heuristic value of node foreach child of node α := max(α, -alphabeta(child, depth-1, -β, -α)) (* use symmetry, -β becomes subsequently pruned α *) if β≤α break (* Beta cut-off *) return α (* Initial call *) alphabeta(origin, depth, -infinity, +infinity) |
Depth First For the problem being solved, check the Blackplanet site for the puzzles. It shouldn't be difficult to figure which the solves. Here is the main class. I can send the rest if there's any interest. package com.blackplanet.puzzle; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Stack; import java.util.StringTokenizer; public class ShortestUserPath implements Runnable { private String connectionsFileName; private String startUserName; private String endUserName; /** * @param args */ public static void main(String[] args) { shortest finder = new shortest(); //Making sure all the required parameters are entered proper. if(args.length < 3) { System.out.println("Come on dude, you did it wrong!\nUsage:\njava com.blackplanet.puzzle.shortest <relations-file-name> <start-user-name> <end-user-name>" ;} if(args.length > 3) { System.out.println("Come on dude, you did it wrong!Usage:\njava com.blackplanet.puzzle.shortest <relations-file-name> <start-user-name> <end-user-name>" ;} else { finder.setConnectionsFileName(args[0]); finder.setStartUserName(args[1]); finder.setEndUserName(args[2]); Thread finderThread = new Thread(finder); finderThread.start(); } } public void run() { List<BPMember> members = loadMembers(connectionsFileName); //Tree (binary-tree in the case of sample data, technically speaking) representation of BlackPlanet sample members // System.out.println("Member List: " + members); String shortestPath = exec(startUserName, endUserName, members); System.out.println(shortestPath); } public List<BPMember> loadMembers(String fileName) { List<BPMember> members = new ArrayList<BPMember>(); BufferedReader reader; try { reader = new BufferedReader(new FileReader(fileName)); String line = null; String memberName = null; String connectedMemberName = null; while((line = reader.readLine()) != null) { StringTokenizer tk = new StringTokenizer(line, " " ;memberName = tk.nextToken(); connectedMemberName = tk.nextToken(); BPMember member = new BPMember(memberName); if(!members.contains(member)) { members.add(member); } else { member = members.get(members.indexOf(member)); } BPMember connectedMember = new BPMember(connectedMemberName); if(!members.contains(connectedMember)) { members.add(connectedMember); } else { connectedMember = members.get(members.indexOf(connectedMember)); } if(!connectedMember.getConnectingNodes().contains(member)) { connectedMember.addConnectingNode(member); } if(!member.getConnectingNodes().contains(connectedMember)) { member.addConnectingNode(connectedMember); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return members; } public String exec(String startUserName, String endUserName, List<BPMember> members) { StringBuilder builder = new StringBuilder(); int memberIdx = members.indexOf(new BPMember(startUserName)); BPMember startUser = null; if(memberIdx >= 0) { startUser = members.get(memberIdx); } memberIdx = members.indexOf(new BPMember(endUserName)); BPMember endUser = null; if(memberIdx >= 0) { endUser = members.get(memberIdx); } if(startUser != null && endUser != null) { // System.out.println("Ready or not, here I come, you can't hide, " ;Stack<String> currentPath = new Stack<String>(); ArrayList<Stack<String>> pathSolutions = new ArrayList<Stack<String>>(); // long startTime = System.currentTimeMillis(); startUser.findConnection(new BPMember(startUserName), new BPMember(startUserName), new BPMember(endUserName), members.size(), members.size(), currentPath, pathSolutions); // long timeInterval = System.currentTimeMillis() - startTime; if(!pathSolutions.isEmpty()) { // System.out.println(", I think I found something, better check." ;// System.out.println(pathSolutions); // Figuring out the path with the shortest length, ArrayList<Long> pathLengths = new ArrayList<Long>(); for(Iterator<Stack<String>> itr = pathSolutions.iterator(); itr.hasNext(); ) { pathLengths.add(new Long(itr.next().size())); } Collections.sort(pathLengths); long optimalPathLength = pathLengths.get(0); // System.out.println("OPTIMAL_PATH_LENGTH: " + optimalPathLength); ArrayList<Stack<String>> optimalPaths = new ArrayList<Stack<String>>(); optimalPaths.addAll(pathSolutions); Stack<String> path = null; for(Iterator<Stack<String>> itr = pathSolutions.iterator(); itr.hasNext(); ) { path = itr.next(); if(path.size() > optimalPathLength) { optimalPaths.remove(path); //Separating the chaff from the wheat. // System.out.println("Removing the garbage " + path + ", " ;// System.out.println("OPTIMAL_PATH_REDUCED: " + optimalPaths); } } ArrayList<String> optimalPathStrings = new ArrayList<String>(); // System.out.println("And here we are folks!: " + optimalPaths); Stack<String> aPath = null; for(Iterator<Stack<String>> itr = optimalPaths.iterator(); itr.hasNext(); ) { aPath = itr.next(); StringBuilder bldr = new StringBuilder(); for(Iterator<String> j = aPath.iterator(); j.hasNext(); ) { bldr.append(j.next()); if(j.hasNext()) { bldr.append(" " ;} } optimalPathStrings.add(bldr.toString()); } Collections.sort(optimalPathStrings); for(Iterator<String> itr = optimalPathStrings.iterator(); itr.hasNext(); ) { builder.append(itr.next()); if(itr.hasNext()) { builder.append("\n" ;} } } else { // System.out.println("Awwww man! What a waste of time. I want my " + ((double) timeInterval) / 1000.0 + " secs back" ;builder.append("NONE" ;} } else if(startUser == null){ builder.append("Come on dude, we don't have anybody called '" + startUserName + "' in here!" ;} else if(endUser == null){ builder.append("Come on dude, we don't have anybody called " + endUserName + "' in here!" ;} return builder.toString(); } public void setConnectionsFileName(String connectionsFile) { this.connectionsFileName = connectionsFile; } public String getConnectionsFileName() { return connectionsFileName; } public void setStartUserName(String startUserName) { this.startUserName = startUserName; } public String getStartUserName() { return startUserName; } public void setEndUserName(String endUserName) { this.endUserName = endUserName; } public String getEndUserName() { return endUserName; } } |
Depth First For the problem being solved, check the Blackplanet site for the puzzles. It shouldn't be difficult to figure which the solves. Here is the main class. I can send the rest if there's any interest.
|
That's a very stupid bot, but then what do you expect of a bot? Anyway here goes: Minimax/Alpha-beta I initially got the algorithm from a magazine in '96 and I no longer remember the name or edition, neither do I have the actual code (but it should be fairly easy to come up with something even better if I put my mind to it). I got this from Wikipedia: http://en.wikipedia.org/wiki/Alpha-beta_pruning
|
Which would u prefer: @OrderBy or @Sort in sorting a list of entities? |
Minimax/alpha beta I got the initial pseudo-code from a magazine (can't remember the name or edition) way back in '96, and then got another version in the book "Encyclopedia of Artificial Intelligence" by Stuart Shapiro. I no longer have the code as a matter of fact and I had it implemented in QBasic, C, and Java. (though it won't take much to reproduce a better version, since I've gotten way better of course). Right now, I can only quote from Wikipedia: http://en.wikipedia.org/wiki/Alpha-beta_pruning
Depth First Here is the main class: [
Anybody interested in what the code does and the rest can get it on request. |
But since AspectJ is basically an extension of the Java language itself, does it not appear to have an edge over Spring AOP? |
candylips:Actually they usually list them as "required", but they never actually asked for copies for verification (though there was at least more than 1 occasion within the 5 year period I had to send copies of my SCJP certificate since this was required). |
candylips:Nope, in the US. I found a few such, like you'll find a few with Masters listed under "added advantage" or required. Of course they are few. Most of the positions are fine with demonstrable skill, and usually some ask you to do tests on Brainbench.com (I did a few of such). For up to 5 year I worked without anybody asking to see my B.Sc certificate! |
candylips:Problem is, some job positions actually list certifications as "added advantage" or even "required". You wouldn't want a situation you'll see an opportunity you like so much, and that fits you almost perfectly, except for the certification part. |
Anybody using these? I am beginning to wonder how I've done without annotations for so long. They've been particularly useful in conjunction with AOP (AspectJ) and the JPA annotations have eliminated the use of XML files and simplified relation definitions, etc. Which are the ones you use most often? Of course mine are those for the JPA and now AspectJ will feature more often. |
OK let's talk about algorithms. I have not implemented many. Actually just 2 as far as I can remember. Minimax with alpha-beta pruning This is used for the move selection by the computer in a group of games referred to as Games of Perfect Information (such as Chess, Checkers, etc). I implemented this for the game of Ayo. A*/Simple Depth First Usually used for path finding problems. I came up with one for the above (not A*), and another for a Blackplanet puzzle recently. Which have you implemented? |
Thanks a lot for this. |
None that I know of, but I know of 1 that developed some themes. Why don't you go for it, and be the first? ![]() |
candylips:Of course it is, after all it expires every 2 years; meaning yours expired in 2005 and mine expired in 2003 . My SCWCD expired in 2005. SCJEA is more useful though. I paid for it but didn't bother sitting for it. Now I may just complete it before the middle of the year. |
candylips: ![]() |
IG:It really doesn't matter, as it was a good rebuttal to the silly stats posted earlier: http://news.cnet.com/8301-13505_3-9884500-16.html |
1 2 3 4 5 6 7 8 ... 207 208 209 210 211 212 213 214 215 (of 228 pages)
;