投稿時間:2023-03-12 07:07:45 RSSフィード2023-03-12 07:00 分まとめ(10件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
カグア!Google Analytics 活用塾:事例や使い方 | YouTubeポッドキャスト開始は「歌ってみた」音声配信者には朗報! | https://www.kagua.biz/marke/podcast/20230312a1.html | YouTubeポッドキャスト開始は「歌ってみた」音声配信者には朗報Radiotalkやstandfmでは、楽曲申請すればJASRAC管理楽曲などを歌ったり、演奏してみたりすることができました。 | 2023-03-11 21:00:15 | |
golang | Goタグが付けられた新着投稿 - Qiita | Go ローカルで他のモジュールの関数を呼び出す方法 | https://qiita.com/shikichika/items/afae3d39adad0a0487e0 | ingstartedwithmultimodule | 2023-03-12 06:27:49 |
海外TECH | MakeUseOf | How to Design a Logo in 5 Simple Steps | https://www.makeuseof.com/how-to-design-logo/ | design | 2023-03-11 21:30:15 |
海外TECH | DEV Community | Implementing Tic Tac Toe in Vue | https://dev.to/diseyi/implementing-tic-tac-toe-in-vue-57go | Implementing Tic Tac Toe in VueTic Tac Toe game used to be one of my favourite paper games in primary school It was known as X and O I don t quite remember how often I won but I definitely enjoyed playing it Recently my friend eteimz challenged me to build this game with Vue He built the react version You can check it out here reactoe For this tutorial I will be using the Vue Composition API Style In the github repository linked below you can find the code for both Composition and Options API We start by initializing the states of our game winner to store the winner s value isTie this stores a boolean value false in the beginning and if no winner is set to true gameover this holds a boolean value false at the beginning and is set to true when a winner emerges or isTie is true currentplayer stores the value of the current playera array also known as a matrix lt script setup lang ts gt import ref reactive from vue const winner ref lt string null gt null const isTie ref false const gameover ref false const currentPlayer ref X let board reactive lt script gt Next step is our templateInside the board div the first div with a class of rows represents the rows which include an inner div that represents the cells in each row A click event is attached to the cell lt template gt lt div gt lt h class gt TicTac Game lt h gt lt p class gt Current Player lt span class gt currentPlayer lt span gt lt p gt lt div class row v for row rowIndex of board key rowIndex gt lt div class cell v for cell cellIndex of row key cellIndex class cell x cell X cell o cell O disabled cell null click playMove rowIndex cellIndex gt cell lt div gt lt div gt lt div class gt lt p v if winner gt winner wins lt p gt lt p v else if isTie gt It s a tie lt p gt lt button click reset gt Reset Game lt button gt lt div gt lt div gt lt template gt The next step is creating the functions for our game we start with the checkTie This function checks if the current game is in a tied state The checkTie function uses a nested loop to iterate over each cell on the x game board It starts by initializing two variables i and j to zero and increments them until they reach three The i and j variables represent the row and column index of each cell on the board With each iteration of the loop the function checks if the cell at the current i and j position is empty if empty the function returns false If the loop completes without finding any empty cell the function returns true resulting in a tied state between the players const checkTie gt for let i i lt i for let j j lt j if board i j return false return true Our next step is the checkWin function This function checks all the possible ways a player can win and returns true if the current player has won and false otherwise Inside the function the for loop checks each row and column of the board to see if all the cells in the row or column match the current player s value This is done by using the every method on each row and column to check if every cell in that row or column is equal to the current value If a row or column is found where every cell matches the current player s value the function returns true to indicate that the current player has won the game If no winning row or column is found the function checks the two diagonals of the board to see if they are all equal to the current player s value If a diagonal is found where all cells are equal to the current value the function returns true to indicate that the current player has won the game If no winning row column or diagonal is found the function returns false to indicate that the game is not yet won by the current player const checkWin gt const a currentPlayer value for let i i lt i if board i every cell gt cell a return true if board every row gt row i a return true Check diagonals if board a amp amp board a amp amp board a return true if board a amp amp board a amp amp board a return true return false Our next function is the playMove function This function updates the board when a player makes a move it takes in two arguments row and col which represent the coordinates of the cell that the player clicks The function first checks if the cell is empty board row col and if there is no winner yet winner value If both of these conditions are true then it proceeds to update the game board with the current player s value The checkWin function is then called to check if the current player has won the game If the current player has won the winner variable is updated with the current player s value If not the checkTie function is called to check if the game is tied If the game is tied the isTie variable is set to true If the game is not won or tied the currentPlayer variable is updated to the other player s title This is done using a ternary operator that checks if the current player is X If so it switches to O and vice versa const playMove row number col number gt if board row col amp amp winner value board row col currentPlayer value if checkWin winner value currentPlayer value else if checkTie isTie value true else currentPlayer value currentPlayer value X O X Finally we have the reset function to reset the state of our game to its default state const reset gt board currentPlayer value X gameover value false winner value null Here s the css used for this gamebody margin display flex min width px min height vh app max width px margin auto padding rem text align center tic tac toe text align center board display inline block margin top px row clear both cell width px height px float left margin right px margin bottom px line height px text align center border px solid bbb cursor pointer font size px cell x color f cell o color f button margin top px font size px padding px border radius px background color ccc border none cursor pointer Link to the the github repo tictac game repo | 2023-03-11 21:25:02 |
海外TECH | Engadget | Relativity Space's 3D-printed rocket fails to lift off during second launch attempt | https://www.engadget.com/relativity-spaces-3d-printed-rocket-fails-to-lift-off-during-second-launch-attempt-211805294.html?src=rss | Relativity Space x s D printed rocket fails to lift off during second launch attemptAnother day another scrub for the world s first D printed rocket On Saturday Relativity Space s Terran rocket failed to get off the ground after two launch attempts It was a day of false starts Following Wednesday s scrub Relativity Space initially set its sights on a PM ET launch a window the company later pushed back to PM ET due to quot upper level wind violations quot nbsp After the countdown restarted all was going well until a boat entered the spacecraft s range Once the countdown resumed again the company called a launch abort at t minus zero after the spacecraft s nine first stage Aeon engines roared to life and then cut off almost immediately after After blaming a quot launch commit criteria violation quot for the PM abort Relativity Space said it would attempt to fly the rocket again at PM ET just as its launch window was about to close for the day Unfortunately the second time around Relativity called an abort before Terran could even ignite its engines As of the writing of this article the company did not provide a reason for the decision but said the rocket was quot healthy quot and that it would have more information to share soon nbsp nbsp Provided it can get off the ground Terran would represent a significant milestone for spaceflight technology While the rocket isn t completely D printed percent of its mass is including its entire structure and first and second stage engines In theory Terran s manufacturing process produces a spacecraft that is cheaper and faster to make Relativity Space claims it can build a Terran rocket in about days and that exclusive missions will cost around million to complete With future spacecraft the company hopes to make around percent of the vehicle from D printed parts nbsp This article originally appeared on Engadget at | 2023-03-11 21:18:05 |
ニュース | BBC News - Home | Gary Lineker: BBC boss Tim Davie 'sorry' after sport disruption in Lineker row | https://www.bbc.co.uk/news/uk-64918162?at_medium=RSS&at_campaign=KARANGA | coverage | 2023-03-11 21:14:52 |
ニュース | BBC News - Home | Indian Wells: Emma Raducanu and Jack Draper both win to reach third round | https://www.bbc.co.uk/sport/tennis/64928995?at_medium=RSS&at_campaign=KARANGA | indian | 2023-03-11 21:33:28 |
ビジネス | 東洋経済オンライン | 急成長ミネベアミツミ、14年ぶり社長交代の真意 「売上高2倍」に向け、買収路線は変わるのか | IT・電機・半導体・部品 | 東洋経済オンライン | https://toyokeizai.net/articles/-/658368?utm_source=rss&utm_medium=http&utm_campaign=link_back | 東洋経済オンライン | 2023-03-12 06:30:00 |
ビジネス | 東洋経済オンライン | 「寅にとって不幸な時代」日本社会が失ったもの 山田洋次監督が語る「男はつらいよ」の世界 | 映画・音楽 | 東洋経済オンライン | https://toyokeizai.net/articles/-/658462?utm_source=rss&utm_medium=http&utm_campaign=link_back | 山田洋次 | 2023-03-12 06:02:00 |
ビジネス | 東洋経済オンライン | 「男はつらいよ」の地方ロケで抱き続けた疑問 山田洋次監督が語る「男はつらいよ」の世界 | 映画・音楽 | 東洋経済オンライン | https://toyokeizai.net/articles/-/658463?utm_source=rss&utm_medium=http&utm_campaign=link_back | 山田洋次 | 2023-03-12 06:01:00 |
コメント
コメントを投稿