Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2753 connectés 

 

Sujet(s) à lire :
    - Who's who@Programmation
 

 Mot :   Pseudo :  
  Aller à la page :
 
 Page :   1  2  3  4  5  ..  25139  25140  25141  ..  26985  26986  26987  26988  26989  26990
Auteur Sujet :

[blabla@olympe] Le topic du modo, dieu de la fibre et du monde

n°2434078
Ydalb
In Crêpes n' Cidre I Trust!
Posté le 02-12-2022 à 11:46:01  profilanswer
 

Reprise du message précédent :
La tienne ça va, c'est celle de Hepha :D


---------------
:o
mood
Publicité
Posté le 02-12-2022 à 11:46:01  profilanswer
 

n°2434080
Flaie
Posté le 02-12-2022 à 12:03:43  profilanswer
 
n°2434082
R3g
fonctionnaire certifié ITIL
Posté le 02-12-2022 à 12:13:47  profilanswer
 


Ouais mais il a même pas compris que le deuxième paramètre est la taille du tableau


---------------
Au royaume des sourds, les borgnes sont sourds.
n°2434083
ratibus
Posté le 02-12-2022 à 12:19:59  profilanswer
 

hephaestos a écrit :

J'ai essayé d'écrire en modulo, j'ai perdu 10 minutes, j'ai écrit la table (j'ai collecté mes étoiles), puis j'ai utilisé ça pour corriger mes modulos...


La vérité éclate enfin :D
 

koskoz a écrit :


 
Non mais là t'as un PO qui te dit qu'on doit supprimer toutes les données si demandée et à côté t'as la compta qui fait no no no [:drraoultihu]


Mauvais PO, changer PO.

skeye a écrit :

Bon, comme de toute manière j'ai aucune chance de finir dans les premiers je prends mon temps pour faire ça de manière pas trop triviale :D



Ydalb a écrit :


 
J'aime ce côté pragmatique :D
 
https://github.com/Ydalb/adventofco [...] /solve.php
 
 
 
Sympa :D


Les gars, désolé, je valide pas vos PR :o

Ydalb a écrit :


 
 
 
J'attendais une remarque de ce type :D
 
Je me casse un peu la tête à comprendre ta version :o Ça fait pas tilt encore


Et on n'est qu'au jour 2  :sol:  

n°2434084
SekYo
Posté le 02-12-2022 à 12:26:31  profilanswer
 

Toujours dans l'optique de faire ma dose de Rust annuelle, partie 2 du day 2. Clairement overkill, mais je voulais pratiquer un peu les enum en Rust. J'aime bien le match sur le tuple (Opposant, résultat attendu), je trouve que dans le cas de règles métiers pas trop nombreuses, ça traduit bien le business en étant très lisible

Spoiler :

#[derive(Copy, Clone)]
enum Play {
    Rock = 1,
    Paper = 2,
    Scissors = 3,
}

 

enum RoundResult {
    Lost = 0,
    Draw = 3,
    Won = 6,
}

 

impl Play {
    fn from_str(input: &str) -> Play {
        match input {
            "A" => Play::Rock,
            "B" => Play::Paper,
            "C" => Play::Scissors,
            _ => panic!("Invalid play" ),
        }
    }
}

 

impl RoundResult {
    fn from_str(input: &str) -> RoundResult {
        match input {
            "X" => RoundResult::Lost,
            "Y" => RoundResult::Draw,
            "Z" => RoundResult::Won,
            _ => panic!("Invalid result" ),
        }
    }
}

 

impl Play {
    fn get_my_play(opponent_play: &Play, expected_result: &RoundResult) -> Play {
        match (opponent_play, expected_result) {
            (Play::Rock, RoundResult::Lost) => Play::Scissors,
            (Play::Rock, RoundResult::Won) => Play::Paper,
            (Play::Paper, RoundResult::Lost) => Play::Rock,
            (Play::Paper, RoundResult::Won) => Play::Scissors,
            (Play::Scissors, RoundResult::Lost) => Play::Paper,
            (Play::Scissors, RoundResult::Won) => Play::Rock,
            (any_play, RoundResult::Draw) => *any_play,
        }
    }
}

 

fn day2() {
    let rounds = include_str!("../data/day2.txt" ).lines();
    let score: i32 = rounds
        .into_iter()
        .map(|line| {
            let round: Vec<_> = line.split(' ').collect();
            let opponent_play = Play::from_str(round.first().unwrap());
            let expected_result = RoundResult::from_str(round.get(1).unwrap());
            let my_play = Play::get_my_play(&opponent_play, &expected_result);
            expected_result as i32 + my_play as i32
        })
        .sum();
    dbg!(score);
}

 


el muchacho a écrit :


- grosse lenteur pour entrer/sortir du mode veille. Alors que sur mon Lenovo, ça prend 3s, sur le Dell, ça prend facile 20s


T'es sur que c'est pas une histoire de mode veille différent ? Y a des modes veilles plus ou moins "profond" (hibernation des fois ils appellent ça je crois ?)
Une telle différence entre les deux sur le même type de veille serait surprenant.

Message cité 1 fois
Message édité par SekYo le 02-12-2022 à 12:28:40
n°2434085
Ydalb
In Crêpes n' Cidre I Trust!
Posté le 02-12-2022 à 12:28:23  profilanswer
 

Faudrait tenter de faire l’AOC avec de l’IA :o

Message cité 1 fois
Message édité par Ydalb le 02-12-2022 à 12:28:31

---------------
:o
n°2434086
skeye
Posté le 02-12-2022 à 12:43:16  profilanswer
 

ratibus a écrit :


Les gars, désolé, je valide pas vos PR :o


 
Pourquoi, parce-que j'ai pas fait la version chiante précalculée? :o


---------------
Can't buy what I want because it's free -
n°2434087
masklinn
í dag viðrar vel til loftárása
Posté le 02-12-2022 à 12:49:39  profilanswer
 

SekYo a écrit :

Toujours dans l'optique de faire ma dose de Rust annuelle, partie 2 du day 2. Clairement overkill, mais je voulais pratiquer un peu les enum en Rust. J'aime bien le match sur le tuple (Opposant, résultat attendu), je trouve que dans le cas de règles métiers pas trop nombreuses, ça traduit bien le business en étant très lisible  

Spoiler :

#[derive(Copy, Clone)]
enum Play {
    Rock = 1,
    Paper = 2,
    Scissors = 3,
}
 
enum RoundResult {
    Lost = 0,
    Draw = 3,
    Won = 6,
}
 
impl Play {
    fn from_str(input: &str) -> Play {
        match input {
            "A" => Play::Rock,
            "B" => Play::Paper,
            "C" => Play::Scissors,
            _ => panic!("Invalid play" ),
        }
    }
}
 
impl RoundResult {
    fn from_str(input: &str) -> RoundResult {
        match input {
            "X" => RoundResult::Lost,
            "Y" => RoundResult::Draw,
            "Z" => RoundResult::Won,
            _ => panic!("Invalid result" ),
        }
    }
}
 
impl Play {
    fn get_my_play(opponent_play: &Play, expected_result: &RoundResult) -> Play {
        match (opponent_play, expected_result) {
            (Play::Rock, RoundResult::Lost) => Play::Scissors,
            (Play::Rock, RoundResult::Won) => Play::Paper,
            (Play::Paper, RoundResult::Lost) => Play::Rock,
            (Play::Paper, RoundResult::Won) => Play::Scissors,
            (Play::Scissors, RoundResult::Lost) => Play::Paper,
            (Play::Scissors, RoundResult::Won) => Play::Rock,
            (any_play, RoundResult::Draw) => *any_play,
        }
    }
}
 
fn day2() {
    let rounds = include_str!("../data/day2.txt" ).lines();
    let score: i32 = rounds
        .into_iter()
        .map(|line| {
            let round: Vec<_> = line.split(' ').collect();
            let opponent_play = Play::from_str(round.first().unwrap());
            let expected_result = RoundResult::from_str(round.get(1).unwrap());
            let my_play = Play::get_my_play(&opponent_play, &expected_result);
            expected_result as i32 + my_play as i32
        })
        .sum();
    dbg!(score);
}



Je pense que des méthodes utilitaires bien placées pourraient être pas mal, genre prev() / next() sur `Play` que tu appellerais dans le cas idoine.
 
(note: tu peux juste ajouter une dépendance sur enum_iterator pour l'avoir sans rien faire :D)

SekYo a écrit :

T'es sur que c'est pas une histoire de mode veille différent ? Y a des modes veilles plus ou moins "profond" (hibernation des fois ils appellent ça je crois ?)
Une telle différence entre les deux sur le même type de veille serait surprenant.


Tu peux aussi avoir le rallumage des périphériques qui se chie dessus, ptet?


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°2434088
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:06:01  profilanswer
 

masklinn a écrit :


Musk aime juste pas quand t’es pas gentil avec lui et…
https://img3.super-h.fr/images/2022 [...] 073.md.jpg
 [:sardine a l'huile]
Mais c’est absolument pas pour ça que ye s’est fait bannir juste après, melon l’a bien dit
https://img3.super-h.fr/images/2022 [...] 658.md.jpg
 [:hansaplast:1]


Merci pour la clarification, melon le narcissiste à l'ego fragile.  :jap:  
Je croyais que tu étais un "absolute free speech" lover ? Où est l' "incitement for violence" dans le post "Ye love everyone" ?  [:itm]

Message cité 1 fois
Message édité par el muchacho le 02-12-2022 à 13:07:59

---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434089
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:15:02  profilanswer
 

Ydalb a écrit :

Faudrait tenter de faire l’AOC avec de l’IA :o


J'y ai pensé. Je pense que GPTchat devrait arriver premier :o


Message édité par el muchacho le 02-12-2022 à 14:03:19

---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
mood
Publicité
Posté le 02-12-2022 à 13:15:02  profilanswer
 

n°2434090
masklinn
í dag viðrar vel til loftárása
Posté le 02-12-2022 à 13:18:45  profilanswer
 

el muchacho a écrit :


Merci pour la clarification, melon le narcissiste à l'ego fragile.  :jap:  
Je croyais que tu étais un "absolute free speech" lover ?


Autant que tous les conservateurs, "free speech for me".

el muchacho a écrit :

Où est l' "incitement for violence" dans le post "Ye love everyone" ?  [:itm]


C'est plus dans les swastikas et les interviews avec des nazis où il dit que hitler a pas fait que des mauvais truc et part en full neg :D


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°2434091
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:20:39  profilanswer
 


Et ce qui tue, c'est que c'est une IA généraliste. Il est semble-t'il incollable sur à peu près tous les sujets.
C'est juste hallucinant...
https://www.ladn.eu/tech-a-suivre/c [...] -racontez/


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434093
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:45:10  profilanswer
 

Bon, je viens de faire un test:

Citation :

The diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, can tell you many useful things about the conditions of the submarine. The first parameter to check is the power consumption.

 

You need to use the binary numbers in the diagnostic report to generate two new binary numbers (called the gamma rate and the epsilon rate). The power consumption can then be found by multiplying the gamma rate by the epsilon rate.

 

Each bit in the gamma rate can be determined by finding the most common bit in the corresponding position of all numbers in the diagnostic report. For example, given the following diagnostic report:

 

00100
11110
10110
10111
10101
01111
00111
11100
10000
11001
00010
01010
Considering only the first bit of each number, there are five 0 bits and seven 1 bits. Since the most common bit is 1, the first bit of the gamma rate is 1.

 

The most common second bit of the numbers in the diagnostic report is 0, so the second bit of the gamma rate is 0.

 

The most common value of the third, fourth, and fifth bits are 1, 1, and 0, respectively, and so the final three bits of the gamma rate are 110.

 

So, the gamma rate is the binary number 10110, or 22 in decimal.

 

The epsilon rate is calculated in a similar way; rather than use the most common bit, the least common bit from each position is used. So, the epsilon rate is 01001, or 9 in decimal. Multiplying the gamma rate (22) by the epsilon rate (9) produces the power consumption.

 

Use the binary numbers in your diagnostic report to calculate the gamma rate and epsilon rate, then multiply them together. What is the power consumption of the submarine? (Be sure to represent your answer in decimal, not binary.)

 

Réponse:

 
Citation :

Power Consumption = 198


Citation :

Next, you should verify the life support rating, which can be determined by multiplying the oxygen generator rating by the CO2 scrubber rating.

 

Both the oxygen generator rating and the CO2 scrubber rating are values that can be found in your diagnostic report - finding them is the tricky part. Both values are located using a similar process that involves filtering out values until only one remains. Before searching for either rating value, start with the full list of binary numbers from your diagnostic report and consider just the first bit of those numbers. Then:

 

Keep only numbers selected by the bit criteria for the type of rating value for which you are searching. Discard numbers which do not match the bit criteria.
If you only have one number left, stop; this is the rating value for which you are searching.
Otherwise, repeat the process, considering the next bit to the right.
The bit criteria depends on which type of rating value you want to find:

 

To find oxygen generator rating, determine the most common value (0 or 1) in the current bit position, and keep only numbers with that bit in that position. If 0 and 1 are equally common, keep values with a 1 in the position being considered.
To find CO2 scrubber rating, determine the least common value (0 or 1) in the current bit position, and keep only numbers with that bit in that position. If 0 and 1 are equally common, keep values with a 0 in the position being considered.
For example, to determine the oxygen generator rating value using the same example diagnostic report from above:

 

Start with all 12 numbers and consider only the first bit of each number. There are more 1 bits (7) than 0 bits (5), so keep only the 7 numbers with a 1 in the first position: 11110, 10110, 10111, 10101, 11100, 10000, and 11001.
Then, consider the second bit of the 7 remaining numbers: there are more 0 bits (4) than 1 bits (3), so keep only the 4 numbers with a 0 in the second position: 10110, 10111, 10101, and 10000.
In the third position, three of the four numbers have a 1, so keep those three: 10110, 10111, and 10101.
In the fourth position, two of the three numbers have a 1, so keep those two: 10110 and 10111.
In the fifth position, there are an equal number of 0 bits and 1 bits (one each). So, to find the oxygen generator rating, keep the number with a 1 in that position: 10111.
As there is only one number left, stop; the oxygen generator rating is 10111, or 23 in decimal.
Then, to determine the CO2 scrubber rating value from the same example above:

 

Start again with all 12 numbers and consider only the first bit of each number. There are fewer 0 bits (5) than 1 bits (7), so keep only the 5 numbers with a 0 in the first position: 00100, 01111, 00111, 00010, and 01010.
Then, consider the second bit of the 5 remaining numbers: there are fewer 1 bits (2) than 0 bits (3), so keep only the 2 numbers with a 1 in the second position: 01111 and 01010.
In the third position, there are an equal number of 0 bits and 1 bits (one each). So, to find the CO2 scrubber rating, keep the number with a 0 in that position: 01010.
As there is only one number left, stop; the CO2 scrubber rating is 01010, or 10 in decimal.
Finally, to find the life support rating, multiply the oxygen generator rating (23) by the CO2 scrubber rating (10).

 

Use the binary numbers in your diagnostic report to calculate the oxygen generator rating and CO2 scrubber rating, then multiply them together. What is the life support rating of the submarine? (Be sure to represent your answer in decimal, not binary.)


Réponse:

Citation :

The life support rating of the submarine is 230.


C'est correct [:hide][:wiids][:alarmclock1]


Message édité par el muchacho le 02-12-2022 à 14:08:49

---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434094
Flaie
Posté le 02-12-2022 à 13:46:33  profilanswer
 

el muchacho a écrit :


Et ce qui tue, c'est que c'est une IA généraliste. Il est semble-t'il incollable sur à peu près tous les sujets.
C'est juste hallucinant...
https://www.ladn.eu/tech-a-suivre/c [...] -racontez/


Effectivement je viens de créer un compte, tu peux poser des questions sur a peu près tout.
 

Citation :

> Explain me why Metz in France is a far superior city to Nancy
 
It is not necessarily accurate to say that one city is superior to another, as personal preferences and individual experiences may vary. However, some potential reasons why someone may consider Metz to be a superior city to Nancy could include:
 

  • Metz has a rich history and cultural heritage, with a well-preserved old town and numerous historical landmarks, such as the Gothic Cathedral of Saint-Étienne and the Centre Pompidou-Metz modern art museum. Nancy, on the other hand, may not have as many well-known cultural attractions.
  • Metz is located in the Lorraine region, which is known for its cuisine and wines. The city is home to a number of Michelin-starred restaurants and has a vibrant food and drink scene, with a large weekly market and many local specialty shops. Nancy may not have as strong of a culinary reputation.
  • Metz has a higher population and is a larger city, with a wider range of amenities and services. It has a thriving arts and entertainment scene, with regular events and festivals, as well as a lively nightlife. Nancy may not have as many options for leisure and entertainment.
  • Metz is well-connected, with easy access to major highways and a high-speed train station, making it convenient for both business and leisure travel. Nancy may not have as good of transportation links.


These are just a few potential reasons why someone may consider Metz to be a superior city to Nancy. Ultimately, the decision of which city is superior will depend on individual preferences and priorities.

n°2434095
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:47:41  profilanswer
 

Flaie a écrit :


Effectivement je viens de créer un compte, tu peux poser des questions sur a peu près tout.
 

Citation :

> Explain me why Metz in France is a far superior city to Nancy
 
It is not necessarily accurate to say that one city is superior to another, as personal preferences and individual experiences may vary. However, some potential reasons why someone may consider Metz to be a superior city to Nancy could include:
 

  • Metz has a rich history and cultural heritage, with a well-preserved old town and numerous historical landmarks, such as the Gothic Cathedral of Saint-Étienne and the Centre Pompidou-Metz modern art museum. Nancy, on the other hand, may not have as many well-known cultural attractions.
  • Metz is located in the Lorraine region, which is known for its cuisine and wines. The city is home to a number of Michelin-starred restaurants and has a vibrant food and drink scene, with a large weekly market and many local specialty shops. Nancy may not have as strong of a culinary reputation.
  • Metz has a higher population and is a larger city, with a wider range of amenities and services. It has a thriving arts and entertainment scene, with regular events and festivals, as well as a lively nightlife. Nancy may not have as many options for leisure and entertainment.
  • Metz is well-connected, with easy access to major highways and a high-speed train station, making it convenient for both business and leisure travel. Nancy may not have as good of transportation links.


These are just a few potential reasons why someone may consider Metz to be a superior city to Nancy. Ultimately, the decision of which city is superior will depend on individual preferences and priorities.



 
Je viens de lui faire faire un pb de l'AoC. Il a donné la réponse direct.


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434096
Flaie
Posté le 02-12-2022 à 13:48:32  profilanswer
 

C'est balaise

n°2434097
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 13:51:33  profilanswer
 

Flaie a écrit :

C'est balaise


C'est ultra balèze ouai  :lol:


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434098
Flaie
Posté le 02-12-2022 à 13:58:26  profilanswer
 

Il a mis bien 30-40 secondes à me pondre une implémentation thread-safe d'un singleton en Java, avec explications, c'est quand même assez fort.  
Pareil j'ai demandé fibonacci en tail-recursive en OCaml pour voir si il voit de quoi on parle, zéro soucis.
 
Je suis quand même sacrément sur le cul  :lol:  
 

Citation :

> Given an adjacency list representing a graph, can you generate an algorithm to find the shortest path between two nodes using A star?
 
Yes, here is an outline of an algorithm for finding the shortest path between two nodes in a graph using A* search:
 
Start at the starting node and initialize the open and closed sets. The open set should contain the starting node, and the closed set should be empty.
 
Select the node in the open set with the lowest A* score (which is a combination of the actual cost from the starting node and the estimated cost to the goal node), and remove it from the open set.
 
If the selected node is the goal node, then the shortest path has been found and the algorithm can terminate.
 
If the selected node is not the goal node, then do the following:
a. Loop through each neighbor of the selected node.
b. If the neighbor is not in the closed set, then calculate the A* score for the neighbor and add it to the open set.
c. If the neighbor is already in the open set, then check if the new A* score is lower than the previous score. If it is, then update the A* score for the neighbor and update the neighbor's parent to be the selected node.
 
Add the selected node to the closed set.
 
Repeat steps 2-5 until the goal node is found or there are no more nodes in the open set. If the goal node is not found, then there is no path between the starting node and the goal node.
 
If the goal node is found, then the shortest path can be reconstructed by starting at the goal node and following the chain of parents back to the starting node.
 
This algorithm uses the A* search algorithm to find the shortest path between two nodes in a graph. It does this by using a combination of the actual cost from the starting node and the estimated cost to the goal node (also known as the heuristic) to determine the next node to explore. This allows the algorithm to explore the graph in a more efficient manner than a simple breadth-first search or depth-first search.
 
> Can you code it for me in Kotlin ?
 
Sure, here is an implementation of the A* algorithm in Kotlin:

Code :
  1. fun shortestPath(graph: Map<String, Map<String, Int>>, start: String, goal: String): List<String> {
  2.   // initialize the open and closed sets
  3.   val openSet = mutableSetOf(start)
  4.   val closedSet = mutableSetOf<String>()
  5.   // initialize the cameFrom map and the gScore and fScore maps
  6.   val cameFrom = mutableMapOf<String, String>()
  7.   val gScore = mutableMapOf(start to 0)
  8.   val fScore = mutableMapOf(start to heuristic(start, goal))
  9.   // loop through the open set until the goal is found or there are no more nodes to explore
  10.   while (openSet.isNotEmpty()) {
  11.     // select the node with the lowest fScore and remove it from the open set
  12.     val current = openSet.minBy { fScore[it] ?: Int.MAX_VALUE }!!
  13.     openSet.remove(current)
  14.     // if the selected node is the goal, then the shortest path has been found
  15.     if (current == goal) {
  16.       // return the shortest path
  17.       return reconstructPath(cameFrom, current)
  18.     }
  19.     // add the selected node to the closed set
  20.     closedSet.add(current)
  21.     // loop through each neighbor of the selected node
  22.     for (neighbor in graph[current]!!.keys) {
  23.       // if the neighbor is not in the closed set, then calculate its fScore and add it to the open set
  24.       if (neighbor !in closedSet) {
  25.         val tentativeGScore = gScore[current]!! + graph[current]!![neighbor]!!
  26.         if (neighbor !in openSet) {
  27.           openSet.add(neighbor)
  28.         } else if (tentativeGScore >= gScore[neighbor]!!) {
  29.           // if the neighbor is already in the open set and the new gScore is not lower than the previous gScore, then skip this neighbor
  30.           continue
  31.         }
  32.         // update the cameFrom, gScore, and fScore values for the neighbor
  33.         cameFrom[neighbor] = current
  34.         gScore[neighbor] = tentativeGScore
  35.         fScore[neighbor] = gScore[neighbor]!! + heuristic(neighbor, goal)
  36.       }
  37.     }
  38.   }
  39.   // if the goal was not found, then there is no path between the start and goal nodes
  40.   return emptyList()
  41. }
  42. // this function calculates the heuristic (estimated cost to the goal) for a given node
  43. fun heuristic(node: String, goal: String): Int {
  44.   // for this example, the heuristic is just the number of characters that differ between the node and the goal
  45.   return node.zip(goal).count { it.first != it.second }
  46. }
  47. // this function reconstructs the shortest path by following the cameFrom map from the goal node back to the start node
  48. fun reconstructPath(cameFrom: Map<String, String>, current: String): List<String> {
  49.   val path = mutableListOf(current)
  50.   var currentNode = current
  51.   while (currentNode in cameFrom) {
  52.     currentNode = cameFrom[currentNode]!!
  53.     path.add(current.....


 
This implementation of the A* algorithm uses a map to represent the graph, where the keys are the nodes and the values are maps of the neighbor nodes and the costs to reach them. The shortestPath function takes the graph, the starting node, and the goal node as input, and returns the shortest path between the two nodes as a list of nodes.
 
The shortestPath function uses the A* algorithm to search the graph, using the heuristic function to calculate the estimated cost to the goal node for each node. The heuristic function used in this example simply calculates the number of characters that differ between the node and the goal. This is just one example of a heuristic function, and other more sophisticated heuristics could be used instead.
 
The shortestPath function also uses the reconstructPath function to reconstruct the shortest path once it has been found. This function uses the cameFrom map to trace

n°2434099
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 14:06:47  profilanswer
 

masklinn a écrit :


Autant que tous les conservateurs, "free speech for me".


 

masklinn a écrit :


C'est plus dans les swastikas et les interviews avec des nazis où il dit que hitler a pas fait que des mauvais truc et part en full neg :D


Oui, je sais bien. Je me faisais l'avocat du diable dans le sens où les critères de bannissement sont assez variables sur Twitter. En général, on peut dire les pires horreurs tant qu'on n'utilise pas des mots bannis. Typiquement les idées néo nazies ont parfaitement droit de cité, vu que c'est du "free speech". Du coup si on suit cette ligne de pensée, le tweet de Kanye West ne satisfait pas les critères de bannissement. Tout ça pour dire que c'est en réalité complètement arbitraire et que l'excuse de Melon ne tient pas.


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434100
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 14:12:01  profilanswer
 

Citation :


What makes Gustav Mahler a brilliant composer ?
 
Gustav Mahler was a brilliant composer for a number of reasons. He was a master orchestrator, combining the lush textures of Romanticism with the more modern sounds of the 20th century. His music often contained complex and powerful emotional content, ranging from the darkest depths of despair to the soaring heights of joy. He was also a great innovator, combining elements of classical, folk, and popular music to create something entirely new. His works are often highly dramatic, and he was one of the first composers to embrace the concept of program music, which uses music to tell a story. His music is also highly influential, and has inspired many composers who came after him.
 
What sets Beethoven's last sonatas apart ?
 
Beethoven's last sonatas are often seen as a culmination of the composer's work, exhibiting a complexity and depth that surpasses his earlier works. These sonatas are notable for their harmonic and structural innovation, including the use of polyrhythms, more complex forms, extended modulations, and more daring harmonic progressions. They also feature unconventional techniques, such as the "hammering" of the same chord multiple times. These works are some of the most admired in all of classical music, and are seen as a major milestone in the development of the piano sonata.


 
J'adore [:vapeur_cochonne]


Message édité par el muchacho le 02-12-2022 à 14:13:40

---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434101
fiscalisat​or
tu dois rompre
Posté le 02-12-2022 à 14:12:20  profilanswer
 

el muchacho a écrit :


Oui, je sais bien. Je me faisais l'avocat du diable dans le sens où les critères de bannissement sont assez variables sur Twitter. En général, on peut dire les pires horreurs tant qu'on n'utilise pas des mots bannis. Typiquement les idées néo nazies ont parfaitement droit de cité, vu que c'est du "free speech". Du coup si on suit cette ligne de pensée, le tweet de Kanye West ne satisfait pas les critères de bannissement. Tout ça pour dire que c'est en réalité complètement arbitraire et que l'excuse de Melon ne tient pas.


Cite moi un post twitter avec des idées néo nazie stp.

Message cité 1 fois
Message édité par fiscalisator le 02-12-2022 à 14:12:35
n°2434102
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 14:15:06  profilanswer
 

fiscalisator a écrit :


Cite moi un post twitter avec des idées néo nazie stp.


Non, j'ai largement quitté Twitter. Et je ne vais pas perdre mon temps à remuer la merde pour toi.


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434103
gatsu35
Blablaté par Harko
Posté le 02-12-2022 à 14:47:06  profilanswer
 

Je viens de tenter le chatbot de gpt 3 :  
 

Citation :


raconte moi une histoire avec un marin sur une petite barque qui rencontre un requin

Citation :


 
Il était une fois un marin solitaire qui naviguait sur une petite barque dans les eaux calmes de l'océan. Un jour, alors qu'il pêchait tranquillement, il aperçut soudain un énorme requin qui fonçait droit sur lui.
 
Le marin ne savait pas quoi faire. Il ne pouvait pas nager aussi vite que le requin et il n'avait pas d'arme pour se défendre. Alors, il a fait preuve de toute sa ruse et de son ingéniosité.
 
Il a pris un morceau de son filet de pêche et l'a attaché à la proue de sa barque. Puis, il a commencé à ramer aussi vite qu'il pouvait pour échapper au requin. Le requin le suivait de près, essayant de le mordre avec ses dents acérées.
 
Mais le marin était plus malin que le requin. Il a continué à ramer jusqu'à ce qu'il arrive près d'une île. Là, il a brusquement changé de direction et a foncé droit sur la plage. Le requin a essayé de le suivre, mais il a été pris dans le filet que le marin avait attaché à la proue de sa barque.
 
Le marin s'est alors échoué sur la plage, sain et sauf. Il a coupé le filet pour libérer le requin, qui a finalement compris qu'il avait été battu par un adversaire plus malin que lui. Le marin a remercié la chance d'être encore en vie et est reparti en mer, plus sage et plus fort que jamais.

Message cité 1 fois
Message édité par gatsu35 le 02-12-2022 à 14:50:04

---------------
Blablaté par Harko
n°2434104
sligor
Posté le 02-12-2022 à 15:09:18  profilanswer
 

gatsu35 a écrit :

Je viens de tenter le chatbot de gpt 3 :  
 

Citation :


raconte moi une histoire avec un marin sur une petite barque qui rencontre un requin

Citation :


 
Il était une fois un marin solitaire qui naviguait sur une petite barque dans les eaux calmes de l'océan. Un jour, alors qu'il pêchait tranquillement, il aperçut soudain un énorme requin qui fonçait droit sur lui.
 
Le marin ne savait pas quoi faire. Il ne pouvait pas nager aussi vite que le requin et il n'avait pas d'arme pour se défendre. Alors, il a fait preuve de toute sa ruse et de son ingéniosité.
 
Il a pris un morceau de son filet de pêche et l'a attaché à la proue de sa barque. Puis, il a commencé à ramer aussi vite qu'il pouvait pour échapper au requin. Le requin le suivait de près, essayant de le mordre avec ses dents acérées.
 
Mais le marin était plus malin que le requin. Il a continué à ramer jusqu'à ce qu'il arrive près d'une île. Là, il a brusquement changé de direction et a foncé droit sur la plage. Le requin a essayé de le suivre, mais il a été pris dans le filet que le marin avait attaché à la proue de sa barque.
 
Le marin s'est alors échoué sur la plage, sain et sauf. Il a coupé le filet pour libérer le requin, qui a finalement compris qu'il avait été battu par un adversaire plus malin que lui. Le marin a remercié la chance d'être encore en vie et est reparti en mer, plus sage et plus fort que jamais.



WTF  [:tibo2002]

n°2434105
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 15:10:54  profilanswer
 

Bon par contre il est naze en raisonnement, comme les humains  :

Citation :


Two bicyclists start twenty miles apart and head toward each other, each going at a steady rate of 10 m.p.h. At the same time a fly that travels at a steady 15 m.p.h. starts from the front wheel of the southbound bicycle and flies to the front wheel of the northbound one, then turns around and flies to the front wheel of the southbound one again, and continues in this manner till he is crushed between the two front wheels. Question: what total distance did the fly cover ?
 
The fly will cover a total distance of 200 miles.
 
How did you get to this answer ?
 
The fly will travel 10 miles south to meet the southbound bike, then 10 miles north to meet the northbound bike, then 10 miles south to meet the southbound bike again, and will repeat this pattern until it is crushed between the two wheels. Since the fly is traveling 15 m.p.h., and it takes 20 miles to complete one cycle, it will take 200 miles (20 cycles x 10 miles) for the fly to complete its journey.


C'est n'imp.  :lol: La bonne réponse, c'est 15 miles, tout simplement en remarquant qu'il faut 1h pour les cyclistes pour se rencontrer.


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434106
el_barbone
too old for this shit ...
Posté le 02-12-2022 à 15:11:14  profilanswer
 

el muchacho a écrit :


Non, j'ai largement quitté Twitter. Et je ne vais pas perdre mon temps à remuer la merde pour toi.


grandement aidé par la moderation de twitter quand il y en avait encore une ...  [:el_barbone:5]


---------------
En théorie, la théorie et la pratique sont identiques, en pratique, non.
n°2434107
Flaie
Posté le 02-12-2022 à 15:12:10  profilanswer
 
n°2434108
gatsu35
Blablaté par Harko
Posté le 02-12-2022 à 15:14:44  profilanswer
 

Citation :


Si un vélo A part et roule à 20km/h et qu'un vélo B part 20 minutes plus tard et qu'il roule à 30km/h.
Au bout de combien de kilomètre le vélo B va rattraper vélo A.
Donne moi le calcul.


 

Citation :


Pour calculer le nombre de kilomètres que le vélo B doit parcourir pour rattraper le vélo A, il faut d'abord calculer la distance parcourue par le vélo A au moment où le vélo B part. Comme le vélo A roule à 20 km/h pendant 20 minutes, il parcourra 20 km/h x (20/60) = 6,67 km.
 
Ensuite, il faut calculer le temps qu'il faudra au vélo B pour rattraper le vélo A. Comme le vélo B roule à une vitesse supérieure à celle du vélo A, il parcourra la distance en moins de temps. La vitesse du vélo B est de 30 km/h, donc il parcourra la distance de 6,67 km en 6,67 km / 30 km/h = 0,22 heures.
 
Enfin, il faut convertir le temps en minutes pour pouvoir soustraire le temps de départ du vélo B. Comme il y a 60 minutes dans une heure, le vélo B parcourra la distance en 0,22 heures x 60 minutes/heure = 13,2 minutes. Si on soustrait le temps de départ du vélo B (20 minutes), on obtient 13,2 minutes - 20 minutes = -6,8 minutes. Comme le résultat est négatif, cela signifie que le vélo B rattrapera le vélo A avant d'avoir parcouru la distance de 6,67 km.
 
Pour calculer la distance exacte parcourue par le vélo B avant de rattraper le vélo A, il faut utiliser la formule de la vitesse moyenne : distance = (vitesse initiale x temps) + (vitesse finale x temps). Comme le vélo B a une vitesse initiale de 0 km/h (il vient de partir) et une vitesse finale de 30 km/h, la formule s'écrit comme suit :
 
distance = (0 km/h x temps) + (30 km/h x temps)
distance = 0 + (30 km/h x temps)
distance = 30 km/h x temps
 
En substituant la valeur de temps obtenue précédemment (-6,8 minutes), on obtient :
 
distance = 30 km/h x (-6,8 minutes)
distance = 30 km/h x (-0,113 heures)
distance = -3,4 km
 
Comme le résultat est négatif, cela signifie que le vélo B rattrapera le vélo A avant d'avoir parcouru la distance de 3,4 km.


---------------
Blablaté par Harko
n°2434109
ratibus
Posté le 02-12-2022 à 15:29:17  profilanswer
 

skeye a écrit :


 
Pourquoi, parce-que j'ai pas fait la version chiante précalculée? :o


Non mais les array_map de array_map je trouve pas ça lisible et d'autant + avec les paramètres nommés partout sur les appels (qui je trouve ajoute bcp de bruit dans la majorité des cas).

n°2434110
Ydalb
In Crêpes n' Cidre I Trust!
Posté le 02-12-2022 à 15:39:09  profilanswer
 

J'suis d'accord Skeye c'est illisible mais moi c'est nickel  [:duckxks:1]

 
Spoiler :

:o

`

 
Spoiler :

Vous tombez bien il reste 2 postes pour du dev PHP chez moi, viendez :o


Message édité par Ydalb le 02-12-2022 à 15:41:49

---------------
:o
n°2434111
R3g
fonctionnaire certifié ITIL
Posté le 02-12-2022 à 15:47:46  profilanswer
 

gatsu35 a écrit :

Citation :


Si un vélo A part et roule à 20km/h et qu'un vélo B part 20 minutes plus tard et qu'il roule à 30km/h.
Au bout de combien de kilomètre le vélo B va rattraper vélo A.
Donne moi le calcul.


 

Citation :


Pour calculer le nombre de kilomètres que le vélo B doit parcourir pour rattraper le vélo A, il faut d'abord calculer la distance parcourue par le vélo A au moment où le vélo B part. Comme le vélo A roule à 20 km/h pendant 20 minutes, il parcourra 20 km/h x (20/60) = 6,67 km.
 
Ensuite, il faut calculer le temps qu'il faudra au vélo B pour rattraper le vélo A. Comme le vélo B roule à une vitesse supérieure à celle du vélo A, il parcourra la distance en moins de temps. La vitesse du vélo B est de 30 km/h, donc il parcourra la distance de 6,67 km en 6,67 km / 30 km/h = 0,22 heures.
 
Enfin, il faut convertir le temps en minutes pour pouvoir soustraire le temps de départ du vélo B. Comme il y a 60 minutes dans une heure, le vélo B parcourra la distance en 0,22 heures x 60 minutes/heure = 13,2 minutes. Si on soustrait le temps de départ du vélo B (20 minutes), on obtient 13,2 minutes - 20 minutes = -6,8 minutes. Comme le résultat est négatif, cela signifie que le vélo B rattrapera le vélo A avant d'avoir parcouru la distance de 6,67 km.
 
Pour calculer la distance exacte parcourue par le vélo B avant de rattraper le vélo A, il faut utiliser la formule de la vitesse moyenne : distance = (vitesse initiale x temps) + (vitesse finale x temps). Comme le vélo B a une vitesse initiale de 0 km/h (il vient de partir) et une vitesse finale de 30 km/h, la formule s'écrit comme suit :
 
distance = (0 km/h x temps) + (30 km/h x temps)
distance = 0 + (30 km/h x temps)
distance = 30 km/h x temps
 
En substituant la valeur de temps obtenue précédemment (-6,8 minutes), on obtient :
 
distance = 30 km/h x (-6,8 minutes)
distance = 30 km/h x (-0,113 heures)
distance = -3,4 km
 
Comme le résultat est négatif, cela signifie que le vélo B rattrapera le vélo A avant d'avoir parcouru la distance de 3,4 km.



C'est un peu comme la question sur Metz - Nancy de Flaie tout à l'heure : la réponse est bien écrite (au sens "ça fait humain" ), mais le "raisonnement" derrière est complètement foireux.


---------------
Au royaume des sourds, les borgnes sont sourds.
n°2434112
Flaie
Posté le 02-12-2022 à 15:55:10  profilanswer
 

R3g a écrit :


C'est un peu comme la question sur Metz - Nancy de Flaie tout à l'heure : la réponse est bien écrite (au sens "ça fait humain" ), mais le "raisonnement" derrière est complètement foireux.


Enfin quand même s'il te plait  [:flaie:8]

n°2434114
skeye
Posté le 02-12-2022 à 16:02:30  profilanswer
 

ratibus a écrit :


Non mais les array_map de array_map je trouve pas ça lisible et d'autant + avec les paramètres nommés partout sur les appels (qui je trouve ajoute bcp de bruit dans la majorité des cas).


 
les array_map de array_map je suis pas méga fan non plus en vrai, faut pas aller plus loin que là. :D
Et les paramètres nommés par contre, avec une coloration syntaxique correcte je préfère - ça m'évite les doutes avec l'ordre parfois pas cohérent de php. :o
Ca donne un poil verbeux, là, tout de même. :o


---------------
Can't buy what I want because it's free -
n°2434115
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 16:07:20  profilanswer
 

R3g a écrit :


C'est un peu comme la question sur Metz - Nancy de Flaie tout à l'heure : la réponse est bien écrite (au sens "ça fait humain" ), mais le "raisonnement" derrière est complètement foireux.


Il est expert en enfumage, par contre.  :lol:  
Bon ça prouve une chose, c'est qu'il faut quand même vérifier dans le détail les réponses qu'il donne.
C'est assez bizarre, d'ailleurs. Le problème que j'ai donné plus haut, on dirait qu'il commence par donner toujours la même réponse fausse, et ensuite invente un argumentaire (complètement erronné) pour la justifier. Avec le paramètre d'aléatoire, à chaque fois que je resoumets le pb, il donne un argument un peu différent, mais toujours pour arriver sur le même résultat faux. Parfois, il est très proche de trouver le bon raisonnement, sauf qu'il se plante avec aplomb, et ensuite il invente des arguments bidons. Un peu comme un élève qui se fait coller au tableau, d'ailleurs.


---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434116
masklinn
í dag viðrar vel til loftárása
Posté le 02-12-2022 à 16:08:18  profilanswer
 

Putain je commence à comprendre pourquoi tout le monde utilise syn pour les macros procédurales rust, avec juste proc_macros simplement extraire et valider un paramètre entier est déjà une plaie monumentale. proc_macros de base à l’air faut pour générer des tokens mais absolument pas pour les consommer.


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°2434117
Jubijub
Parce que je le VD bien
Posté le 02-12-2022 à 16:09:29  profilanswer
 

c'est hyper impressionnant quand meme ce ChatGPT. C'est même très humain : ça peut des fois raconter de la merde, mais c'est tellement assertif et sur de soi que tu peux y croire (et en ce sens là c'est bluffant, je sais pas si j'arriverais à dire si j'ai un humain ou un bot face à moi).


---------------
Jubi Photos : Flickr - 500px
n°2434118
R3g
fonctionnaire certifié ITIL
Posté le 02-12-2022 à 16:10:46  profilanswer
 

el muchacho a écrit :


Il est expert en enfumage, par contre.  :lol:  
Bon ça prouve une chose, c'est qu'il faut quand même vérifier dans le détail les réponses qu'il donne.
C'est assez bizarre, d'ailleurs. Le problème que j'ai donné plus haut, on dirait qu'il commence par donner toujours la même réponse fausse, et ensuite invente un argumentaire (complètement erronné) pour la justifier. Avec le paramètre d'aléatoire, à chaque fois que je resoumets le pb, il donne un argument un peu différent, mais toujours pour arriver sur le même résultat faux. Parfois, il est très proche de trouver le bon raisonnement, sauf qu'il se plante avec aplomb, et ensuite il invente des arguments bidons. Un peu comme un élève qui se fait coller au tableau, d'ailleurs.


Sinon on est d'accord, la réponse à la question était 20 km ?


---------------
Au royaume des sourds, les borgnes sont sourds.
n°2434119
R3g
fonctionnaire certifié ITIL
Posté le 02-12-2022 à 16:11:30  profilanswer
 

Jubijub a écrit :

c'est hyper impressionnant quand meme ce ChatGPT. C'est même très humain : ça peut des fois raconter de la merde, mais c'est tellement assertif et sur de soi que tu peux y croire (et en ce sens là c'est bluffant, je sais pas si j'arriverais à dire si j'ai un humain ou un bot face à moi).


Il faudrait l'envoyer débattre du vaccin covid sur twitter


---------------
Au royaume des sourds, les borgnes sont sourds.
n°2434120
el muchach​o
Comfortably Numb
Posté le 02-12-2022 à 16:13:44  profilanswer
 

R3g a écrit :


Sinon on est d'accord, la réponse à la question était 20 km ?


Non, 15 miles, j'ai donné l'explication plus haut: les 2 cyclistes sont séparés de 20 miles au départ, et roulent à 10 à l'heure, donc se rencontrent au milieu en 1h. En 1h, la mouche parcourt 15 miles à 15 miles/h.

 

Autre raisonnement: la mouche est 1,5x plus rapide que les cyclistes. Comme ceux-ci se rencontrent après 10 miles chacun, elle aura parcouru 1,5x10  = 15 miles pendant la même durée.


Message édité par el muchacho le 02-12-2022 à 16:15:59

---------------
Les aéroports où il fait bon attendre, voila un topic qu'il est bien
n°2434121
Flaie
Posté le 02-12-2022 à 16:15:50  profilanswer
 

Jubijub a écrit :

c'est hyper impressionnant quand meme ce ChatGPT. C'est même très humain : ça peut des fois raconter de la merde, mais c'est tellement assertif et sur de soi que tu peux y croire (et en ce sens là c'est bluffant, je sais pas si j'arriverais à dire si j'ai un humain ou un bot face à moi).


demande lui une implémenterai Kotlin pour l'AOC de ce jour au fait !

n°2434122
sligor
Posté le 02-12-2022 à 16:20:55  profilanswer
 

Jubijub a écrit :

c'est hyper impressionnant quand meme ce ChatGPT. C'est même très humain : ça peut des fois raconter de la merde, mais c'est tellement assertif et sur de soi que tu peux y croire (et en ce sens là c'est bluffant, je sais pas si j'arriverais à dire si j'ai un humain ou un bot face à moi).


Un Idriss Aberkane generator en sorte  :o

mood
Publicité
Posté le   profilanswer
 

 Page :   1  2  3  4  5  ..  25139  25140  25141  ..  26985  26986  26987  26988  26989  26990

Aller à :
Ajouter une réponse
 

Sujets relatifs
Plus de sujets relatifs à : [blabla@olympe] Le topic du modo, dieu de la fibre et du monde


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)