Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,299 members, 7,819,008 topics. Date: Monday, 06 May 2024 at 09:55 AM |
Nairaland Forum / Kingvicky's Profile / Kingvicky's Posts
Celebrities / Re: See Viral Video Of The Pretty Lady Banned From Restaurant For Farting by kingvicky(m): 7:31pm On Jul 27, 2019 |
enquizzle: Where's the link to comments? |
Celebrities / Re: See Viral Video Of The Pretty Lady Banned From Restaurant For Farting by kingvicky(m): 10:27pm On Jul 25, 2019 |
Where's the link to people talking about this? |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 4:44pm On May 14, 2019 |
Kelgabriel5:Thanks man! |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 4:43pm On May 14, 2019 |
Kelgabriel5:OK bro! |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 1:53pm On May 14, 2019 |
Kelgabriel5:In the instructions, we are to submit our project for review.. |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 2:43pm On May 13, 2019 |
Please guys I wanna know. Do we submit each challenge separately? I mean the bootcamp challenges. |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 2:10pm On May 13, 2019 |
YorubaEmir: Add me pls.. 08186405915 |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 3:10pm On May 07, 2019 |
Who put in for cycle 45? Check your mail, I was extended an invitation to the bootcamp. 1 Like |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 2:08am On May 06, 2019 |
I'm a bit worried. I had an interview on Friday (for cycle 45) but I'm yet to receive any mail. |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 6:02am On May 04, 2019 |
suckmywilly:This calms my nerves. 1 Like |
Jobs/Vacancies / Re: Andela: IT Training And Job by kingvicky(m): 6:00am On May 04, 2019 |
minlinx:Die is actually the singular form. Yours is still probable. But looking at the challenge, a singular form is meant. |
Health / Re: Advice Needed by kingvicky(m): 8:08pm On Apr 06, 2019 |
Juicysnatch: You say? Chai!! Your mess ehn! |
Health / Re: Advice Needed by kingvicky(m): 2:54am On Mar 28, 2019 |
Juicysnatch:What food makes you fart (mess)? |
Romance / Re: I Don't Get Into The Mood For Sex Unless My Girlfriend Pollutes The Air by kingvicky(m): 12:19am On Feb 27, 2019 |
Andyblaze:Yes you're perfectly normal. There is no abnormal sexual inclination. Sex is generally weird and everyone has what arouses them. Some people are aroused by the smell of poop, certain ladies do not get aroused until their spouse beats them, some people love torture from a female to get aroused. Yours is a case of eproctophilia |
Programming / Seeking Placement/internship Opportunity by kingvicky(m): 11:52pm On Feb 26, 2019 |
Hello house. I need a placement to observe a year industrial training in computer science preferably software development. I am versed in Java and JavaScript. 1 Like |
Religion / Re: What Is Termed "Moral"? by kingvicky(m): 7:15pm On Dec 14, 2018 |
LordReed:Would our morality be superior if it actually depends on what this God dictates? |
Religion / Re: What Is Termed "Moral"? by kingvicky(m): 5:27pm On Dec 14, 2018 |
LordReed: How would our morality be superior to this God's morality if he/she actually defines what is moral regardless of how depraved it is? |
Religion / Re: Why Does Glory Dome Have No Cross Of Christ On The Building Or At The Altar ? by kingvicky(m): 11:36am On Dec 14, 2018 |
Christistruth00: The cross is actually a pagan symbol associated with fertility, life and in some cases intercourse. |
Religion / What Is Termed "Moral"? by kingvicky(m): 10:58am On Dec 14, 2018 |
Socrates once asked a question which when considered in the context in which it was presented, was relevant to the capricious gods of ancient Greece but does have its implications on monotheistic religions. The question is: "Is the pious loved by the gods because it is pious or is it pious because it is loved by the gods?". Known as the Euthyphro dilemma, it is valid and is controversial. Now the question is, "Is what is morally good allowed by God because it is morally good or it is morally good because it is allowed by God". Not to leave one stupefied, I will cite as example the incidence of Uzzah stretching forth his arm to touch the ark and he was immediately struck by God. Taking that as point example, is the very act (the killing) right because it was done by God or is it right because it is morally sound to kill? 1 Like |
Religion / Re: Atheist/theists:what Kind Of Evidence Would Convince You That God Exists Or Not? by kingvicky(m): 10:53pm On Dec 06, 2018 |
hahn: I don't think it matters as to which god it is. Any chief god in any pantheon fits the description (Ahura Mazda, Chukwu Okike e.t.c) |
Romance / Re: What Has Been Your Most Embarrassing Moment Ever by kingvicky(m): 12:45pm On Oct 11, 2018 |
MobolaCrown: So u fart a lot? |
Romance / Re: Man Slaps His Girlfriend For Wanting To Fry Four Eggs For Herself (Pic) by kingvicky(m): 1:24am On Aug 22, 2018 |
LivingFree: Hmm. Hot fart |
Programming / Need To Work On A Project With Some Guys. by kingvicky(m): 11:33pm On Jul 14, 2018 |
I'm itching to work on a project with anyone... I know Java, Spring, NodeJs, and a bit of Angular and VanillaJs.. Please post link to repo... Add me as a collaborator... My username is kingsley-einstein |
Jokes Etc / Re: The Nigerian Star ( ODUNLADE ADEKOLA ) Get Into An Accident Yesterday by kingvicky(m): 3:46pm On May 30, 2018 |
HOPE NOTHING BAD HAPPEN TO HIM |
Jokes Etc / Re: TRENDING #SHO MO AGE MI NI Video Compilation Is Out {watch Now!!!!!} by kingvicky(m): 3:44pm On May 30, 2018 |
post=68005663:I DONT KNOW HOW I'S TRENDING |
Programming / Re: Html & Css by kingvicky(m): 10:20pm On May 09, 2018 |
09090329362 |
Romance / Re: I Left My Female Friend Because She Fart(mess)a Lot by kingvicky(m): 12:08am On May 04, 2018 |
predmine20:Abeg who be d lady? |
Programming / Just Curious.. by kingvicky(m): 11:21am On Apr 30, 2018 |
Is it okay to know AngularJs with just a basic knowledge of JavaScript? |
Programming / Command Line Tic-tac-toe With Smart AI by kingvicky(m): 11:02am On Apr 30, 2018 |
import java.util.*; class Move { int r; int c; Move(int r, int c) { this.r=r; this.c=c; } @Override public String toString() { return "Move [ "+(this.r+1)+" , "+(this.c+1)+" ]"; } } class ChildNodes { Move move; int value; ChildNodes(Move move, int value) { this.move=move; this.value=value; } @Override public String toString() { return " value: "+this.value; } } class Board { int[][] board=new int[3][3]; char[][] mark=new char[3][3]; List<Move> availableMoves; List<ChildNodes> childNodes; List<Move> getAvailableMoves() { availableMoves=new ArrayList<>(); for (int i=0; i<board.length; i++) { for (int j=0; j<board.length; j++) { if (board[i][j] == 0) { availableMoves.add(new Move(i, j)); } } } return availableMoves; } void showBoard() { for (int i=0; i<board.length; i++) { for (int j=0; j<board.length; j++) { if (board[i][j] == 0) { mark[i][j] = '-'; } if (board[i][j] == 1) { mark[i][j] = 'X'; } if (board[i][j] == 2) { mark[i][j] = 'O'; } System.out.print("\t["+mark[i][j]+"]\t" } System.out.println(); } } void showHint() { System.out.println(); for (int i=1; i<=3; i++) { for (int j=1; j<=3; j++) { System.out.print("\t["+i+""+j+"]\t" } System.out.println(); } } boolean xHasWon() { for (int i=0; i<board.length; i++) { if ((board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] == 1) || (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[2][i] == 1)) { return true; } if ( i == 0) { if ((board[i][i] == board[1][1] && board[1][1] == board[2][2] && board[2][2] == 1) || (board[i][2] == board[1][1] && board[1][1] == board[2][i] && board[i][2] == 1)) { return true; } } } return false; } boolean oHasWon() { for (int i=0; i<board.length; i++) { if ((board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] == 2) || (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[2][i] == 2)) { return true; } if ( i == 0) { if ((board[i][i] == board[1][1] && board[1][1] == board[2][2] && board[2][2] == 2) || (board[i][2] == board[1][1] && board[1][1] == board[2][i] && board[i][2] == 2)) { return true; } } } return false; } boolean isGameOver() { return xHasWon() || oHasWon() || getAvailableMoves().isEmpty(); } void placeMove(Move m, int player) { board[m.r][m.c]=player; } int minimax(int depth, boolean turn) { List<Move> legalStates=getAvailableMoves(); if (xHasWon()) { return +1; } if (oHasWon()) { return -1; } if (legalStates.isEmpty() && !xHasWon() && !oHasWon()) { return 0; } int max=Integer.MIN_VALUE; int min=Integer.MAX_VALUE; if (turn) { for (int i=0; i<legalStates.size(); i++) { Move move=legalStates.get(i); placeMove(move, 1); int score=minimax(depth+1, false); max=Math.max(max, score); if (depth == 0 ) { childNodes.add(new ChildNodes(move, max)); } placeMove(move, 0); } } else { for (int i=0; i<legalStates.size(); i++) { Move move=legalStates.get(i); placeMove(move, 2); int score=minimax(depth+1, true); min=Math.min(min, score); if (depth == 0) { childNodes.add(new ChildNodes(move, min)); } placeMove(move, 0); } } return turn?max:min; } Move getBestMove() { int max=Integer.MIN_VALUE; int index=0; for (int i=0; i<childNodes.size(); i++) { if (max < childNodes.get(i).value) { max = childNodes.get(i).value; index = i; } } return childNodes.get(index).move; } void callMinimax(int depth, boolean turn) { childNodes=new ArrayList<>(); minimax(depth, turn); } void newGame() { System.out.println("Welcome to J-Tac-Toe.\n ************************************************************ \n Author: Kingsley Victor \n Version: 1.0.0 \n ************************************************************ " showBoard(); showHint(); System.out.println("\n To place a mark, enter the corresponding row and column value\n \n" Scanner gameInput=new Scanner(System.in); System.out.println("Who plays first? Computer (1), User(2)" int choice=gameInput.nextInt(); while (choice < 1 || choice > 2) { System.out.println("Invalid choice. Enter either 1 or 2 for computer or human to make first move respectively" choice=gameInput.nextInt(); } if (choice == 1) { Random rand=new Random(); Move m=new Move(rand.nextInt(3), rand.nextInt(3)); placeMove(m, 1); showBoard(); showHint(); } while (!isGameOver()) { System.out.println("Make your move. \n \n" int r=gameInput.nextInt()-1; int c=gameInput.nextInt()-1; Move m=new Move(r, c); while(board[m.r][m.c] !=0) { System.out.println("Invalid move. Point is already occupied \n \n" r=gameInput.nextInt()-1; c=gameInput.nextInt()-1; m=new Move(r, c); } placeMove(m, 2); showBoard(); callMinimax(0, true); if (isGameOver()) { System.out.println(); showBoard(); break; } try { System.out.println(); System.out.println("Wait! Computer is thinking!" System.out.println(); Thread.sleep(2000); } catch(InterruptedException e) { } placeMove(getBestMove(), 1); showBoard(); if (!isGameOver()) { showHint(); } } if (xHasWon()) { System.out.println("Computer wins the game" } if (oHasWon()) { System.out.println("Congratulations, you win the game" } if (getAvailableMoves().isEmpty() && !xHasWon() && !oHasWon()) { System.out.println("It's a tie!" } } } public class TicTacToe { public static void main(String[] args) { Board b=new Board(); b.newGame(); } } |
Programming / Re: Is This Really A Programming Section? by kingvicky(m): 5:12pm On Apr 06, 2018 |
seunthomas:Nice idea but what if no one catches my drift? |
Programming / Is This Really A Programming Section? by kingvicky(m): 4:12pm On Apr 06, 2018 |
Where is the vibe, the motivation? There is nothing that ignites the passion of those who really need to get a feel of that coding vibe in this section. It's a cyber-graveyard filled with dead threads most of which are zombies (threads made years ago yet with recent comments). I'm quite at an intermediate level as regards coding but there are times I feel like giving up or trashing that feeling to write cool programs and I go to forums to get motivated but what I see here is a morale killer. |
Programming / Re: Da Fuk Is Wrong With This Board? Useless Threads Everywhere!! by kingvicky(m): 11:47am On Apr 06, 2018 |
phililp:Finally someone who thinks the same as I do. Since the start of BBNaija this year, almost all threads I come across are devoted to the tomfoolery and carousel that sprouts from the show. And threads are seldom commented on. Advancements will soon be supplanted by all such reality shows have to offer. |
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 48 |